summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorDaniel Berlin <dberlin@dberlin.org>2017-04-10 18:46:00 +0000
committerDaniel Berlin <dberlin@dberlin.org>2017-04-10 18:46:00 +0000
commit74603a68efb57f36fccb32caac1313ee39421da6 (patch)
treee51d2175b0e2a888fe31de8e5bc42574638b6aaf /llvm
parent1468d3e04ee4f93e7951e902afbc74e585243f3f (diff)
downloadbcm5719-llvm-74603a68efb57f36fccb32caac1313ee39421da6.tar.gz
bcm5719-llvm-74603a68efb57f36fccb32caac1313ee39421da6.zip
MemorySSA: Make lifetime starts defs for mustaliased pointers
Summary: While we don't want them aliasing with other pointers, there seems to be no point in not having them clobber must-aliased'd pointers. If some day, we split the aliasing and ordering chains, we'd make this not aliasing but an ordering barrier (IE it doesn't affect it's memory, but we can't hoist it above it). Reviewers: hfinkel, george.burgess.iv Subscribers: Prazek, llvm-commits Differential Revision: https://reviews.llvm.org/D31865 llvm-svn: 299865
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Transforms/Utils/MemorySSA.cpp6
-rw-r--r--llvm/test/Transforms/Util/MemorySSA/lifetime-simple.ll2
2 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Utils/MemorySSA.cpp b/llvm/lib/Transforms/Utils/MemorySSA.cpp
index f2fc7e165b5..7aecda70836 100644
--- a/llvm/lib/Transforms/Utils/MemorySSA.cpp
+++ b/llvm/lib/Transforms/Utils/MemorySSA.cpp
@@ -214,12 +214,16 @@ static bool instructionClobbersQuery(MemoryDef *MD,
AliasAnalysis &AA) {
Instruction *DefInst = MD->getMemoryInst();
assert(DefInst && "Defining instruction not actually an instruction");
+ ImmutableCallSite UseCS(UseInst);
if (const IntrinsicInst *II = dyn_cast<IntrinsicInst>(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 @@ static bool instructionClobbersQuery(MemoryDef *MD,
}
}
- ImmutableCallSite UseCS(UseInst);
if (UseCS) {
ModRefInfo I = AA.getModRefInfo(DefInst, UseCS);
return I != MRI_NoModRef;
@@ -298,7 +301,6 @@ static bool lifetimeEndsAt(MemoryDef *MD, const MemoryLocation &Loc,
Instruction *Inst = MD->getMemoryInst();
if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(Inst)) {
switch (II->getIntrinsicID()) {
- case Intrinsic::lifetime_start:
case Intrinsic::lifetime_end:
return AA.isMustAlias(MemoryLocation(II->getArgOperand(1)), Loc);
default:
diff --git a/llvm/test/Transforms/Util/MemorySSA/lifetime-simple.ll b/llvm/test/Transforms/Util/MemorySSA/lifetime-simple.ll
index cdb36e31eb9..99406b21048 100644
--- a/llvm/test/Transforms/Util/MemorySSA/lifetime-simple.ll
+++ b/llvm/test/Transforms/Util/MemorySSA/lifetime-simple.ll
@@ -9,7 +9,7 @@ entry:
; 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)
OpenPOWER on IntegriCloud