Prevent folding of a node with multiple uses if the node already folds a load!
authorEvan Cheng <evan.cheng@apple.com>
Fri, 20 Jan 2006 01:11:03 +0000 (01:11 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Fri, 20 Jan 2006 01:11:03 +0000 (01:11 +0000)
commit76356d95944ac2f560c0193c5ca314da7998a366
tree6a79db8d3e04ded4b69f2679e62bfd4ee0b9dc19
parentd900c6a8b3de655bac138cfdf4b9a85b7e64ec1c
Prevent folding of a node with multiple uses if the node already folds a load!
Here is an example where the load ended up being done twice:

%A = global uint 0

uint %test(uint %B, ubyte %C) {
%tmp = load uint *%A;
%X = shl uint %tmp, ubyte %C
%Cv = sub ubyte 32, %C
%Y = shr uint %B, ubyte %Cv
%Z = or uint %Y, %X
store uint %Z, uint* %A
ret uint %Z
}

==>

subl $4, %esp
movl %ebx, (%esp)
movl 8(%esp), %edx
movl A, %eax
movb 12(%esp), %bl
movb %bl, %cl
shldl %cl, %edx, %eax
movb %bl, %cl
shldl %cl, %edx, A
movl (%esp), %ebx
addl $4, %esp
ret

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25471 91177308-0d34-0410-b5e6-96231b3b80d8
utils/TableGen/DAGISelEmitter.cpp