add a simple optimization

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26062 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2006-02-08 17:47:22 +00:00
parent 7e8443fd5a
commit dba382b16a

View File

@ -411,3 +411,19 @@ void clearbit(int *target, int bit) {
*target &= ~(1 << bit);
}
//===---------------------------------------------------------------------===//
Easy: Global addresses are not always allowed as immediates. For this:
int dst = 0; int *ptr = 0;
void foo() { ptr = &dst; }
we get this:
_foo:
movl $_dst, %eax
movl %eax, _ptr
ret
When: "movl $_dst, _ptr" is sufficient.