diff options
author | David Majnemer <david.majnemer@gmail.com> | 2016-07-15 17:19:24 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2016-07-15 17:19:24 +0000 |
commit | a940f360cbaa1fb0da984c5cd311efe85a7d88ae (patch) | |
tree | baffc2b5634d136cf428f8e8d1b6d17499fe246f /llvm/lib/Transforms | |
parent | 3d89db445d1f013a3abb250a1239199a23aae905 (diff) | |
download | bcm5719-llvm-a940f360cbaa1fb0da984c5cd311efe85a7d88ae.tar.gz bcm5719-llvm-a940f360cbaa1fb0da984c5cd311efe85a7d88ae.zip |
[AliasAnalysis] Give back AA results for fence instructions
Calling getModRefInfo with a fence resulted in crashes because fences
don't have a memory location. Add a new predicate to Instruction
called isFenceLike which indicates that the instruction mutates memory
but not any single memory location in particular. In practice, it is a
proxy for the set of instructions which "mayWriteToMemory" but cannot be
used with MemoryLocation::get.
This fixes PR28570.
llvm-svn: 275581
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Utils/MemorySSA.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Utils/MemorySSA.cpp b/llvm/lib/Transforms/Utils/MemorySSA.cpp index 0aed1334571..f93917f9861 100644 --- a/llvm/lib/Transforms/Utils/MemorySSA.cpp +++ b/llvm/lib/Transforms/Utils/MemorySSA.cpp @@ -1252,7 +1252,7 @@ MemoryAccess *MemorySSA::CachingWalker::getClobberingMemoryAccess( // Conservatively, fences are always clobbers, so don't perform the walk if we // hit a fence. - if (isa<FenceInst>(I)) + if (!ImmutableCallSite(I) && I->isFenceLike()) return StartingUseOrDef; UpwardsMemoryQuery Q; @@ -1287,15 +1287,17 @@ MemorySSA::CachingWalker::getClobberingMemoryAccess(const Instruction *I) { // access, since we only map BB's to PHI's. So, this must be a use or def. auto *StartingAccess = cast<MemoryUseOrDef>(MSSA->getMemoryAccess(I)); - // We can't sanely do anything with a FenceInst, they conservatively + bool IsCall = bool(ImmutableCallSite(I)); + + // We can't sanely do anything with a fences, they conservatively // clobber all memory, and have no locations to get pointers from to - // try to disambiguate - if (isa<FenceInst>(I)) + // try to disambiguate. + if (!IsCall && I->isFenceLike()) return StartingAccess; UpwardsMemoryQuery Q; Q.OriginalAccess = StartingAccess; - Q.IsCall = bool(ImmutableCallSite(I)); + Q.IsCall = IsCall; if (!Q.IsCall) Q.StartingLoc = MemoryLocation::get(I); Q.Inst = I; |