diff options
author | Philip Reames <listmail@philipreames.com> | 2021-09-01 16:58:04 -0700 |
---|---|---|
committer | Philip Reames <listmail@philipreames.com> | 2021-09-01 16:59:01 -0700 |
commit | c3b3aa277acaccf85a49d8d74dde3f1e03a38041 (patch) | |
tree | 85fda6da52c774e5491fcd41f66e45ac3770e136 /llvm/lib/Transforms/Utils/LoopUtils.cpp | |
parent | 91f4655d9273ecefab1b7f0ea26d44f5de6fd0af (diff) | |
download | llvm-c3b3aa277acaccf85a49d8d74dde3f1e03a38041.zip llvm-c3b3aa277acaccf85a49d8d74dde3f1e03a38041.tar.gz llvm-c3b3aa277acaccf85a49d8d74dde3f1e03a38041.tar.bz2 |
Fix a missing MemorySSA update in breakLoopBackedge
This is a case I'd missed in 6a8237. The odd bit here is that missing the edge removal update seems to produce MemorySSA which verifies, but is still corrupt in a way which bothers following passes. I wasn't able to reduce a single pass test case, which is why the reported test case is taken as is.
Differential Revision: https://reviews.llvm.org/D109068
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUtils.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/LoopUtils.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp b/llvm/lib/Transforms/Utils/LoopUtils.cpp index 36d8bc5..b8f8ad5 100644 --- a/llvm/lib/Transforms/Utils/LoopUtils.cpp +++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp @@ -729,8 +729,9 @@ void llvm::breakLoopBackedge(Loop *L, DominatorTree &DT, ScalarEvolution &SE, // and outer loop so the other target doesn't need to an exit if (L->isLoopExiting(Latch)) { // TODO: Generalize ConstantFoldTerminator so that it can be used - // here without invalidating LCSSA. (Tricky case: header is an exit - // block of a preceeding sibling loop w/o dedicated exits.) + // here without invalidating LCSSA or MemorySSA. (Tricky case for + // LCSSA: header is an exit block of a preceeding sibling loop w/o + // dedicated exits.) const unsigned ExitIdx = L->contains(BI->getSuccessor(0)) ? 1 : 0; BasicBlock *ExitBB = BI->getSuccessor(ExitIdx); @@ -746,6 +747,8 @@ void llvm::breakLoopBackedge(Loop *L, DominatorTree &DT, ScalarEvolution &SE, BI->eraseFromParent(); DTU.applyUpdates({{DominatorTree::Delete, Latch, Header}}); + if (MSSA) + MSSAU->applyUpdates({{DominatorTree::Delete, Latch, Header}}, DT); return; } } |