[PATCH] D66911: [LoopUnroll] Use Lazy strategy for DTU used for MergeBlockIntoPredecessor.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 28 16:11:25 PDT 2019
fhahn created this revision.
fhahn added reviewers: efriedma, kuhar, asbirlea.
Herald added subscribers: dmgreen, zzheng, hiraditya.
Herald added a project: LLVM.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D66911
Files:
llvm/lib/Transforms/Utils/LoopUnroll.cpp
Index: llvm/lib/Transforms/Utils/LoopUnroll.cpp
===================================================================
--- llvm/lib/Transforms/Utils/LoopUnroll.cpp
+++ llvm/lib/Transforms/Utils/LoopUnroll.cpp
@@ -870,7 +870,7 @@
assert(!DT || !UnrollVerifyDomtree ||
DT->verify(DominatorTree::VerificationLevel::Fast));
- DomTreeUpdater DTU(DT, DomTreeUpdater::UpdateStrategy::Eager);
+ DomTreeUpdater DTU(DT, DomTreeUpdater::UpdateStrategy::Lazy);
// Merge adjacent basic blocks, if possible.
for (BasicBlock *Latch : Latches) {
BranchInst *Term = dyn_cast<BranchInst>(Latch->getTerminator());
@@ -890,6 +890,7 @@
}
}
}
+ DT = &DTU.getDomTree();
// At this point, the code is well formed. We now simplify the unrolled loop,
// doing constant propagation and dead code elimination as we go.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66911.217734.patch
Type: text/x-patch
Size: 841 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190828/095557f6/attachment.bin>
More information about the llvm-commits
mailing list