1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00

[LoopUnroll] Use Lazy strategy for DTU used for MergeBlockIntoPredecessor.

We do not access the DT in the loop, so we do not have to apply updates
eagerly. We can apply them lazyly and flush them after we are done
merging blocks.

As follow-up work, we might be able to use the DTU above as well,
instead of manually updating the DT.

This brings the example from PR43134 from ~100s to ~4s for a relase +
assertions build on my machine.

Reviewers: efriedma, kuhar, asbirlea, brzycki

Reviewed By: kuhar, brzycki

Differential Revision: https://reviews.llvm.org/D66911

llvm-svn: 370292
This commit is contained in:
Florian Hahn 2019-08-29 04:26:29 +00:00
parent 88ec345e4b
commit 3122150e98

View File

@ -870,7 +870,7 @@ LoopUnrollResult llvm::UnrollLoop(Loop *L, UnrollLoopOptions ULO, LoopInfo *LI,
assert(!DT || !UnrollVerifyDomtree || assert(!DT || !UnrollVerifyDomtree ||
DT->verify(DominatorTree::VerificationLevel::Fast)); DT->verify(DominatorTree::VerificationLevel::Fast));
DomTreeUpdater DTU(DT, DomTreeUpdater::UpdateStrategy::Eager); DomTreeUpdater DTU(DT, DomTreeUpdater::UpdateStrategy::Lazy);
// Merge adjacent basic blocks, if possible. // Merge adjacent basic blocks, if possible.
for (BasicBlock *Latch : Latches) { for (BasicBlock *Latch : Latches) {
BranchInst *Term = dyn_cast<BranchInst>(Latch->getTerminator()); BranchInst *Term = dyn_cast<BranchInst>(Latch->getTerminator());
@ -890,6 +890,8 @@ LoopUnrollResult llvm::UnrollLoop(Loop *L, UnrollLoopOptions ULO, LoopInfo *LI,
} }
} }
} }
// Apply updates to the DomTree.
DT = &DTU.getDomTree();
// At this point, the code is well formed. We now simplify the unrolled loop, // At this point, the code is well formed. We now simplify the unrolled loop,
// doing constant propagation and dead code elimination as we go. // doing constant propagation and dead code elimination as we go.