[llvm] 447256f - [runtimeunroll] Fix reported DT verification error after 94d0914
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 19 11:06:32 PDT 2021
Author: Philip Reames
Date: 2021-08-19T11:06:17-07:00
New Revision: 447256f22b4dc125877aed11aac875c03d0228eb
URL: https://github.com/llvm/llvm-project/commit/447256f22b4dc125877aed11aac875c03d0228eb
DIFF: https://github.com/llvm/llvm-project/commit/447256f22b4dc125877aed11aac875c03d0228eb.diff
LOG: [runtimeunroll] Fix reported DT verification error after 94d0914
In 94d0914, I added support for unrolling of multiple exit loops which have multiple exits reaching the latch. Per reports on the review post commit, I'd missed updating the domtree for one case. This fix addresses that ommission.
There's no new test as this is covered by existing tests with expensive verification turned on.
Added:
Modified:
llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp b/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
index 0bad348c6aa0..cd865521be43 100644
--- a/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
+++ b/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
@@ -285,8 +285,10 @@ static void ConnectEpilog(Loop *L, Value *ModVal, BasicBlock *NewExit,
// Add the branch to the exit block (around the unrolling loop)
B.CreateCondBr(BrLoopExit, EpilogPreHeader, Exit);
InsertPt->eraseFromParent();
- if (DT)
- DT->changeImmediateDominator(Exit, NewExit);
+ if (DT) {
+ auto *NewDom = DT->findNearestCommonDominator(Exit, NewExit);
+ DT->changeImmediateDominator(Exit, NewDom);
+ }
// Split the main loop exit to maintain canonicalization guarantees.
SmallVector<BasicBlock*, 4> NewExitPreds{Latch};
More information about the llvm-commits
mailing list