aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/InlineFunction.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms/Utils/InlineFunction.cpp')
-rw-r--r--lib/Transforms/Utils/InlineFunction.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Transforms/Utils/InlineFunction.cpp b/lib/Transforms/Utils/InlineFunction.cpp
index 8416170d90..3eeedab925 100644
--- a/lib/Transforms/Utils/InlineFunction.cpp
+++ b/lib/Transforms/Utils/InlineFunction.cpp
@@ -734,11 +734,15 @@ static bool hasLifetimeMarkers(AllocaInst *AI) {
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;
}