summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorAlina Sbirlea <asbirlea@google.com>2019-09-17 16:31:37 +0000
committerAlina Sbirlea <asbirlea@google.com>2019-09-17 16:31:37 +0000
commit6b2d1346d8ed4c47fb61a249e0bb246dc9731144 (patch)
tree173c21a9bd164f02a1e4412f163be79e534ac780 /llvm/lib
parent39c5106eec79629f807589794d161bf2ba54fab0 (diff)
downloadbcm5719-llvm-6b2d1346d8ed4c47fb61a249e0bb246dc9731144.tar.gz
bcm5719-llvm-6b2d1346d8ed4c47fb61a249e0bb246dc9731144.zip
[MemorySSA] Update MSSA for non-conventional AA.
Summary: Regularly when moving an instruction that may not read or write memory, the instruction is not modelled in MSSA, so not action is necessary. For a non-conventional AA pipeline, MSSA needs to explicitly check when creating accesses, so as to not model instructions that may not read and write memory. Reviewers: george.burgess.iv Subscribers: Prazek, sanjoy.google, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D67562 llvm-svn: 372137
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Analysis/MemorySSA.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/MemorySSA.cpp b/llvm/lib/Analysis/MemorySSA.cpp
index db12fcee3ef..cc3bca1c231 100644
--- a/llvm/lib/Analysis/MemorySSA.cpp
+++ b/llvm/lib/Analysis/MemorySSA.cpp
@@ -1736,9 +1736,15 @@ MemoryUseOrDef *MemorySSA::createNewAccess(Instruction *I,
// FIXME: Replace this special casing with a more accurate modelling of
// assume's control dependency.
if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(I))
- if (II->getIntrinsicID() == Intrinsic::assume || isa<DbgInfoIntrinsic>(II))
+ if (II->getIntrinsicID() == Intrinsic::assume)
return nullptr;
+ // Using a nonstandard AA pipelines might leave us with unexpected modref
+ // results for I, so add a check to not model instructions that may not read
+ // from or write to memory. This is necessary for correctness.
+ if (!I->mayReadFromMemory() && !I->mayWriteToMemory())
+ return nullptr;
+
bool Def, Use;
if (Template) {
Def = dyn_cast_or_null<MemoryDef>(Template) != nullptr;
OpenPOWER on IntegriCloud