add a simple optimization

llvm-svn: 26062
This commit is contained in:
Chris Lattner 2006-02-08 17:47:22 +00:00
parent 6f5a00fd68
commit b4fc050f0f
1 changed files with 16 additions and 0 deletions

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.