Cleanup/remove some parts of the lifetime region handling code in memdep and GVN,
per Chris' comments. Adjust testcases to match.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90304 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp
index 1b42c6b..ceb57f8 100644
--- a/lib/Transforms/Scalar/GVN.cpp
+++ b/lib/Transforms/Scalar/GVN.cpp
@@ -1187,10 +1187,9 @@
return V;
}
-static bool isLifetimeStartOrEnd(Instruction *Inst) {
+static bool isLifetimeStart(Instruction *Inst) {
if (IntrinsicInst* II = dyn_cast<IntrinsicInst>(Inst))
- return II->getIntrinsicID() == Intrinsic::lifetime_start ||
- II->getIntrinsicID() == Intrinsic::lifetime_end;
+ return II->getIntrinsicID() == Intrinsic::lifetime_start;
return false;
}
@@ -1262,8 +1261,8 @@
// Loading the allocation -> undef.
if (isa<AllocaInst>(DepInst) || isMalloc(DepInst) ||
- // Loading immediately after lifetime begin or end -> undef.
- isLifetimeStartOrEnd(DepInst)) {
+ // Loading immediately after lifetime begin -> undef.
+ isLifetimeStart(DepInst)) {
ValuesPerBlock.push_back(AvailableValueInBlock::get(DepBB,
UndefValue::get(LI->getType())));
continue;
@@ -1635,11 +1634,10 @@
return true;
}
- // If this load occurs either right after a lifetime begin or a lifetime end,
+ // If this load occurs either right after a lifetime begin,
// then the loaded value is undefined.
if (IntrinsicInst* II = dyn_cast<IntrinsicInst>(DepInst)) {
- if (II->getIntrinsicID() == Intrinsic::lifetime_start ||
- II->getIntrinsicID() == Intrinsic::lifetime_end) {
+ if (II->getIntrinsicID() == Intrinsic::lifetime_start) {
L->replaceAllUsesWith(UndefValue::get(L->getType()));
toErase.push_back(L);
NumGVNLoad++;