diff options
author | Kyle Butt <kyle+llvm@iteratee.net> | 2016-08-30 18:18:54 +0000 |
---|---|---|
committer | Kyle Butt <kyle+llvm@iteratee.net> | 2016-08-30 18:18:54 +0000 |
commit | 61aca6ef798aa918833be6125d4600cb95a585ce (patch) | |
tree | aa4d84de77e945dfc600302608275a8148a8cd6b /llvm/lib/CodeGen/TailDuplicator.cpp | |
parent | eb666b7ac54ac3df38b69ee2b281970390603173 (diff) | |
download | bcm5719-llvm-61aca6ef798aa918833be6125d4600cb95a585ce.tar.gz bcm5719-llvm-61aca6ef798aa918833be6125d4600cb95a585ce.zip |
TailDuplication: Extract Indirect-Branch block limit as option. NFC
The existing code hard-coded a limit of 20 instructions for duplication
when a block ended with an indirect branch. Extract this as an option.
No functional change intended.
llvm-svn: 280125
Diffstat (limited to 'llvm/lib/CodeGen/TailDuplicator.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TailDuplicator.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/TailDuplicator.cpp b/llvm/lib/CodeGen/TailDuplicator.cpp index a27e38d2d7d..5434ff66ea5 100644 --- a/llvm/lib/CodeGen/TailDuplicator.cpp +++ b/llvm/lib/CodeGen/TailDuplicator.cpp @@ -40,12 +40,20 @@ STATISTIC(NumTailDupRemoved, STATISTIC(NumDeadBlocks, "Number of dead blocks removed"); STATISTIC(NumAddedPHIs, "Number of phis added"); +namespace llvm { + // Heuristic for tail duplication. static cl::opt<unsigned> TailDuplicateSize( "tail-dup-size", cl::desc("Maximum instructions to consider tail duplicating"), cl::init(2), cl::Hidden); +cl::opt<unsigned> TailDupIndirectBranchSize( + "tail-dup-indirect-size", + cl::desc("Maximum instructions to consider tail duplicating blocks that " + "end with indirect branches."), cl::init(20), + cl::Hidden); + static cl::opt<bool> TailDupVerify("tail-dup-verify", cl::desc("Verify sanity of PHI instructions during taildup"), @@ -54,8 +62,6 @@ static cl::opt<bool> static cl::opt<unsigned> TailDupLimit("tail-dup-limit", cl::init(~0U), cl::Hidden); -namespace llvm { - void TailDuplicator::initMF(MachineFunction &MFin, const MachineBranchProbabilityInfo *MBPIin, unsigned TailDupSizeIn) { @@ -550,7 +556,7 @@ bool TailDuplicator::shouldTailDuplicate(bool IsSimple, HasIndirectbr = TailBB.back().isIndirectBranch(); if (HasIndirectbr && PreRegAlloc) - MaxDuplicateCount = 20; + MaxDuplicateCount = TailDupIndirectBranchSize; // Check the instructions in the block to determine whether tail-duplication // is invalid or unlikely to be profitable. |