[llvm-commits] [llvm] r132906 - /llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
Chris Lattner
clattner at apple.com
Mon Jun 13 10:10:54 PDT 2011
On Jun 13, 2011, at 12:52 AM, Nick Lewycky wrote:
> 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.
Would it make sense to use Value::stripPointerCasts here?
-Chris
>
> 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;
> }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list