From d3a55a8f885eee32e2750d20d7af944482ae60b9 Mon Sep 17 00:00:00 2001 From: Kyle Butt Date: Fri, 4 Aug 2017 21:13:41 +0000 Subject: [PATCH] BlockPlacement: add a flag to force cold block outlining w/o a profile. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310129 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/MachineBlockPlacement.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/CodeGen/MachineBlockPlacement.cpp b/lib/CodeGen/MachineBlockPlacement.cpp index 447ad629885..374b3079c34 100644 --- a/lib/CodeGen/MachineBlockPlacement.cpp +++ b/lib/CodeGen/MachineBlockPlacement.cpp @@ -91,6 +91,11 @@ static cl::opt LoopToColdBlockRatio( "(frequency of block) is greater than this ratio"), cl::init(5), cl::Hidden); +static cl::opt ForceLoopColdBlock( + "force-loop-cold-block", + cl::desc("Force outlining cold blocks from loops."), + cl::init(false), cl::Hidden); + static cl::opt PreciseRotationCost("precise-rotation-cost", cl::desc("Model the cost of loop rotation more " @@ -2146,7 +2151,7 @@ MachineBlockPlacement::collectLoopBlockSet(const MachineLoop &L) { // will be merged into the first outer loop chain for which this block is not // cold anymore. This needs precise profile data and we only do this when // profile data is available. - if (F->getFunction()->getEntryCount()) { + if (F->getFunction()->getEntryCount() || ForceLoopColdBlock) { BlockFrequency LoopFreq(0); for (auto LoopPred : L.getHeader()->predecessors()) if (!L.contains(LoopPred)) -- 2.50.1