aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/MemorySSAUpdater.cpp
diff options
context:
space:
mode:
authorGeorge Burgess IV <george.burgess.iv@gmail.com>2018-05-26 02:28:55 +0000
committerGeorge Burgess IV <george.burgess.iv@gmail.com>2018-05-26 02:28:55 +0000
commit45f263dd90ccd053fbc3c580fe7b33ae1fa0f13f (patch)
treeb67be7e2df80d6f9aca69d2b058c004068f24965 /llvm/lib/Analysis/MemorySSAUpdater.cpp
parentd30bcab70e15d2f90aa516ab9be37b5a39d37bc4 (diff)
downloadllvm-45f263dd90ccd053fbc3c580fe7b33ae1fa0f13f.zip
llvm-45f263dd90ccd053fbc3c580fe7b33ae1fa0f13f.tar.gz
llvm-45f263dd90ccd053fbc3c580fe7b33ae1fa0f13f.tar.bz2
[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*. llvm-svn: 333332
Diffstat (limited to 'llvm/lib/Analysis/MemorySSAUpdater.cpp')
-rw-r--r--llvm/lib/Analysis/MemorySSAUpdater.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/MemorySSAUpdater.cpp b/llvm/lib/Analysis/MemorySSAUpdater.cpp
index e14319b..24a5012 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;