[llvm] r333332 - [MemorySSA] Reflow comments + clean up control flow; NFC

George Burgess IV via llvm-commits llvm-commits at lists.llvm.org
Fri May 25 19:28:56 PDT 2018


Author: gbiv
Date: Fri May 25 19:28:55 2018
New Revision: 333332

URL: http://llvm.org/viewvc/llvm-project?rev=333332&view=rev
Log:
[MemorySSA] Reflow comments + clean up control flow; NFC

Style guide says `else`s after returns are iffy, and I agree. I also
don't know what broke the comments here and in CFLAA, but *shrug*.

Modified:
    llvm/trunk/lib/Analysis/MemorySSA.cpp
    llvm/trunk/lib/Analysis/MemorySSAUpdater.cpp

Modified: llvm/trunk/lib/Analysis/MemorySSA.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/MemorySSA.cpp?rev=333332&r1=333331&r2=333332&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/MemorySSA.cpp (original)
+++ llvm/trunk/lib/Analysis/MemorySSA.cpp Fri May 25 19:28:55 2018
@@ -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;
 

Modified: llvm/trunk/lib/Analysis/MemorySSAUpdater.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/MemorySSAUpdater.cpp?rev=333332&r1=333331&r2=333332&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/MemorySSAUpdater.cpp (original)
+++ llvm/trunk/lib/Analysis/MemorySSAUpdater.cpp Fri May 25 19:28:55 2018
@@ -45,19 +45,25 @@ MemoryAccess *MemorySSAUpdater::getPrevi
   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;
 




More information about the llvm-commits mailing list