Skip to content

Commit

Permalink
[runtimeunroll] Fix reported DT verification error after 94d0914
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
preames committed Aug 19, 2021
1 parent bad3168 commit 447256f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
Expand Up @@ -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};
Expand Down

0 comments on commit 447256f

Please sign in to comment.