Index: llvm/lib/CodeGen/MachineOutliner.cpp =================================================================== --- llvm/lib/CodeGen/MachineOutliner.cpp +++ llvm/lib/CodeGen/MachineOutliner.cpp @@ -113,6 +113,10 @@ cl::desc( "Number of times to rerun the outliner after the initial outline")); +static cl::opt OutlinerBenefitThreshold( + "outliner-benefit-threshold", cl::init(1), cl::Hidden, + cl::desc("The minimum size before an outlining candidate is accpeted")); + namespace { /// Maps \p MachineInstrs to unsigned integers and stores the mappings. @@ -597,7 +601,7 @@ continue; // Is it better to outline this candidate than not? - if (OF.getBenefit() < 1) { + if (OF.getBenefit() < OutlinerBenefitThreshold) { emitNotOutliningCheaperRemark(StringLen, CandidatesForRepeatedSeq, OF); continue; } @@ -771,7 +775,7 @@ }); // If we made it unbeneficial to outline this function, skip it. - if (OF.getBenefit() < 1) + if (OF.getBenefit() < OutlinerBenefitThreshold) continue; // It's beneficial. Create the function and outline its sequence's