aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/TailDuplication.cpp
diff options
context:
space:
mode:
authorKyle Butt <kyle+llvm@iteratee.net>2016-10-11 01:20:33 +0000
committerKyle Butt <kyle+llvm@iteratee.net>2016-10-11 01:20:33 +0000
commitae068a320c753bb1648abdbad2265a09fb47023e (patch)
treee1ba7e25f2e2a19462b83c60e655ba335c9210a3 /llvm/lib/CodeGen/TailDuplication.cpp
parentd19919a80e483b75e0c7a6d893688b3f008df6b4 (diff)
downloadllvm-ae068a320c753bb1648abdbad2265a09fb47023e.zip
llvm-ae068a320c753bb1648abdbad2265a09fb47023e.tar.gz
llvm-ae068a320c753bb1648abdbad2265a09fb47023e.tar.bz2
Codegen: Tail-duplicate during placement.
The tail duplication pass uses an assumed layout when making duplication decisions. This is fine, but passes up duplication opportunities that may arise when blocks are outlined. Because we want the updated CFG to affect subsequent placement decisions, this change must occur during placement. In order to achieve this goal, TailDuplicationPass is split into a utility class, TailDuplicator, and the pass itself. The pass delegates nearly everything to the TailDuplicator object, except for looping over the blocks in a function. This allows the same code to be used for tail duplication in both places. This change, in concert with outlining optional branches, allows triangle shaped code to perform much better, esepecially when the taken/untaken branches are correlated, as it creates a second spine when the tests are small enough. Issue from previous rollback fixed, and a new test was added for that case as well. Issue was worklist/scheduling/taildup issue in layout. Issue from 2nd rollback fixed, with 2 additional tests. Issue was tail merging/loop info/tail-duplication causing issue with loops that share a header block. Issue with early tail-duplication of blocks that branch to a fallthrough predecessor fixed with test case: tail-dup-branch-to-fallthrough.ll Differential revision: https://reviews.llvm.org/D18226 llvm-svn: 283842
Diffstat (limited to 'llvm/lib/CodeGen/TailDuplication.cpp')
-rw-r--r--llvm/lib/CodeGen/TailDuplication.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/TailDuplication.cpp b/llvm/lib/CodeGen/TailDuplication.cpp
index 6e8ee9e..e2377d8 100644
--- a/llvm/lib/CodeGen/TailDuplication.cpp
+++ b/llvm/lib/CodeGen/TailDuplication.cpp
@@ -49,7 +49,7 @@ bool TailDuplicatePass::runOnMachineFunction(MachineFunction &MF) {
auto MBPI = &getAnalysis<MachineBranchProbabilityInfo>();
- Duplicator.initMF(MF, MBPI);
+ Duplicator.initMF(MF, MBPI, /* LayoutMode */ false);
bool MadeChange = false;
while (Duplicator.tailDuplicateBlocks())