From b4d088d090a035ec174ded571e6a7058adf11fef Mon Sep 17 00:00:00 2001 From: Alina Sbirlea Date: Tue, 13 Nov 2018 21:12:49 +0000 Subject: [MemorySSA] Create query after checking if instruction is a fence. The alternative is checking if I is a fence in the Query constructor, so as to not attempt to get a non-existent MemoryLocation. llvm-svn: 346798 --- llvm/lib/Analysis/MemorySSA.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'llvm/lib/Analysis') diff --git a/llvm/lib/Analysis/MemorySSA.cpp b/llvm/lib/Analysis/MemorySSA.cpp index 1e45cc4bdf8..3d98fca823a 100644 --- a/llvm/lib/Analysis/MemorySSA.cpp +++ b/llvm/lib/Analysis/MemorySSA.cpp @@ -2199,13 +2199,14 @@ MemorySSA::CachingWalker::getClobberingMemoryAccess(MemoryAccess *MA) { return StartingAccess->getOptimized(); const Instruction *I = StartingAccess->getMemoryInst(); - UpwardsMemoryQuery Q(I, StartingAccess); // We can't sanely do anything with a fence, since they conservatively clobber // all memory, and have no locations to get pointers from to try to // disambiguate. - if (!Q.IsCall && I->isFenceLike()) + if (!ImmutableCallSite(I) && I->isFenceLike()) return StartingAccess; + UpwardsMemoryQuery Q(I, StartingAccess); + if (isUseTriviallyOptimizableToLiveOnEntry(*MSSA->AA, I)) { MemoryAccess *LiveOnEntry = MSSA->getLiveOnEntryDef(); StartingAccess->setOptimized(LiveOnEntry); -- cgit v1.2.3