Index: lib/Transforms/Utils/MemorySSA.cpp =================================================================== --- lib/Transforms/Utils/MemorySSA.cpp +++ lib/Transforms/Utils/MemorySSA.cpp @@ -214,12 +214,16 @@ AliasAnalysis &AA) { Instruction *DefInst = MD->getMemoryInst(); assert(DefInst && "Defining instruction not actually an instruction"); + ImmutableCallSite UseCS(UseInst); if (const IntrinsicInst *II = dyn_cast(DefInst)) { // These intrinsics will show up as affecting memory, but they are just // markers. switch (II->getIntrinsicID()) { case Intrinsic::lifetime_start: + if (UseCS) + return false; + return AA.isMustAlias(MemoryLocation(II->getArgOperand(1)), UseLoc); case Intrinsic::lifetime_end: case Intrinsic::invariant_start: case Intrinsic::invariant_end: @@ -230,7 +234,6 @@ } } - ImmutableCallSite UseCS(UseInst); if (UseCS) { ModRefInfo I = AA.getModRefInfo(DefInst, UseCS); return I != MRI_NoModRef; @@ -298,7 +301,6 @@ Instruction *Inst = MD->getMemoryInst(); if (IntrinsicInst *II = dyn_cast(Inst)) { switch (II->getIntrinsicID()) { - case Intrinsic::lifetime_start: case Intrinsic::lifetime_end: return AA.isMustAlias(MemoryLocation(II->getArgOperand(1)), Loc); default: Index: test/Transforms/Util/MemorySSA/lifetime-simple.ll =================================================================== --- test/Transforms/Util/MemorySSA/lifetime-simple.ll +++ test/Transforms/Util/MemorySSA/lifetime-simple.ll @@ -9,7 +9,7 @@ ; CHECK: 1 = MemoryDef(liveOnEntry) ; CHECK-NEXT: call void @llvm.lifetime.start(i64 32, i8* %P) call void @llvm.lifetime.start(i64 32, i8* %P) -; CHECK: MemoryUse(liveOnEntry) +; CHECK: MemoryUse(1) ; CHECK-NEXT: %0 = load i8, i8* %P %0 = load i8, i8* %P ; CHECK: 2 = MemoryDef(1)