diff options
author | Kyle Butt <kyle+llvm@iteratee.net> | 2016-08-17 21:07:35 +0000 |
---|---|---|
committer | Kyle Butt <kyle+llvm@iteratee.net> | 2016-08-17 21:07:35 +0000 |
commit | db3391ebe0eaaad8973090cade201478632b72cd (patch) | |
tree | de26c128bfda263027a646124d75f443d937855f /llvm/lib/CodeGen/TailDuplicator.cpp | |
parent | feafec588fcb7d6fbfec6002ea353dc05cdd0aab (diff) | |
download | bcm5719-llvm-db3391ebe0eaaad8973090cade201478632b72cd.tar.gz bcm5719-llvm-db3391ebe0eaaad8973090cade201478632b72cd.zip |
Tail Duplication: Accept explicit threshold for duplicating.
This will allow tail duplication and tail merging during layout to have a
shared threshold to make sure that they don't overlap. No observable change
intended.
llvm-svn: 278981
Diffstat (limited to 'llvm/lib/CodeGen/TailDuplicator.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TailDuplicator.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/TailDuplicator.cpp b/llvm/lib/CodeGen/TailDuplicator.cpp index ec8e48d0de0..a93d13c65ce 100644 --- a/llvm/lib/CodeGen/TailDuplicator.cpp +++ b/llvm/lib/CodeGen/TailDuplicator.cpp @@ -57,12 +57,14 @@ static cl::opt<unsigned> TailDupLimit("tail-dup-limit", cl::init(~0U), namespace llvm { void TailDuplicator::initMF(MachineFunction &MF, const MachineModuleInfo *MMIin, - const MachineBranchProbabilityInfo *MBPIin) { + const MachineBranchProbabilityInfo *MBPIin, + unsigned TailDupSizeIn) { TII = MF.getSubtarget().getInstrInfo(); TRI = MF.getSubtarget().getRegisterInfo(); MRI = &MF.getRegInfo(); MMI = MMIin; MBPI = MBPIin; + TailDupSize = TailDupSizeIn; assert(MBPI != nullptr && "Machine Branch Probability Info required"); @@ -511,12 +513,14 @@ bool TailDuplicator::shouldTailDuplicate(const MachineFunction &MF, // duplicate only one, because one branch instruction can be eliminated to // compensate for the duplication. unsigned MaxDuplicateCount; - if (TailDuplicateSize.getNumOccurrences() == 0 && - // FIXME: Use Function::optForSize(). + if (TailDupSize == 0 && + TailDuplicateSize.getNumOccurrences() == 0 && MF.getFunction()->optForSize()) MaxDuplicateCount = 1; - else + else if (TailDupSize == 0) MaxDuplicateCount = TailDuplicateSize; + else + MaxDuplicateCount = TailDupSize; // If the block to be duplicated ends in an unanalyzable fallthrough, don't // duplicate it. |