[llvm-commits] [llvm] r132906 - /llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
Nick Lewycky
nicholas at mxc.ca
Mon Jun 13 00:52:46 PDT 2011
Author: nicholas
Date: Mon Jun 13 02:52:46 2011
New Revision: 132906
URL: http://llvm.org/viewvc/llvm-project?rev=132906&view=rev
Log:
It's possible that an all-zero GEP may be used as the argument to lifetime
intrinsics. In fact, we'll optimize a bitcast to that when possible. Detect it
when looking for the lifetime intrinsics.
No test case, noticed by inspection.
Modified:
llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
Modified: llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp?rev=132906&r1=132905&r2=132906&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp Mon Jun 13 02:52:46 2011
@@ -734,11 +734,15 @@
if (AI->getType() == Int8PtrTy)
return isUsedByLifetimeMarker(AI);
- // Do a scan to find all the bitcasts to i8*.
+ // Do a scan to find all the bitcasts or GEPs to i8*.
for (Value::use_iterator I = AI->use_begin(), E = AI->use_end(); I != E;
++I) {
if (I->getType() != Int8PtrTy) continue;
- if (!isa<BitCastInst>(*I)) continue;
+ if (GetElementPtrInst *GEPI = dyn_cast<GetElementPtrInst>(*I)) {
+ if (!GEPI->hasAllZeroIndices()) continue;
+ } else if (!isa<BitCastInst>(*I)) {
+ continue;
+ }
if (isUsedByLifetimeMarker(*I))
return true;
}
More information about the llvm-commits
mailing list