Skip to content

Commit

Permalink
[MemorySSA] Reflow comments + clean up control flow; NFC
Browse files Browse the repository at this point in the history
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*.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333332 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
gburgessiv committed May 26, 2018
1 parent 758389d commit 31d7817
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/Analysis/MemorySSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
12 changes: 9 additions & 3 deletions lib/Analysis/MemorySSAUpdater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 31d7817

Please sign in to comment.