diff options
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r-- | llvm/lib/Analysis/MemorySSA.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/Analysis/MemorySSAUpdater.cpp | 12 |
2 files changed, 11 insertions, 5 deletions
diff --git a/llvm/lib/Analysis/MemorySSA.cpp b/llvm/lib/Analysis/MemorySSA.cpp index 6d313bc9231..43fc7d40d78 100644 --- a/llvm/lib/Analysis/MemorySSA.cpp +++ b/llvm/lib/Analysis/MemorySSA.cpp @@ -904,8 +904,8 @@ struct RenamePassData { namespace llvm { /// A MemorySSAWalker that does AA walks to disambiguate accesses. It no -/// longer does caching on its own, -/// but the name has been retained for the moment. +/// longer does caching on its own, but the name has been retained for the +/// moment. class MemorySSA::CachingWalker final : public MemorySSAWalker { ClobberWalker Walker; diff --git a/llvm/lib/Analysis/MemorySSAUpdater.cpp b/llvm/lib/Analysis/MemorySSAUpdater.cpp index e14319bba87..24a50126297 100644 --- a/llvm/lib/Analysis/MemorySSAUpdater.cpp +++ b/llvm/lib/Analysis/MemorySSAUpdater.cpp @@ -45,19 +45,25 @@ MemoryAccess *MemorySSAUpdater::getPreviousDefRecursive( auto Cached = CachedPreviousDef.find(BB); if (Cached != CachedPreviousDef.end()) { return Cached->second; - } else if (BasicBlock *Pred = BB->getSinglePredecessor()) { + } + + if (BasicBlock *Pred = BB->getSinglePredecessor()) { // Single predecessor case, just recurse, we can only have one definition. MemoryAccess *Result = getPreviousDefFromEnd(Pred, CachedPreviousDef); CachedPreviousDef.insert({BB, Result}); return Result; - } else if (VisitedBlocks.count(BB)) { + } + + if (VisitedBlocks.count(BB)) { // We hit our node again, meaning we had a cycle, we must insert a phi // node to break it so we have an operand. The only case this will // insert useless phis is if we have irreducible control flow. MemoryAccess *Result = MSSA->createMemoryPhi(BB); CachedPreviousDef.insert({BB, Result}); return Result; - } else if (VisitedBlocks.insert(BB).second) { + } + + if (VisitedBlocks.insert(BB).second) { // Mark us visited so we can detect a cycle SmallVector<MemoryAccess *, 8> PhiOps; |