[PATCH] D136774: [Outliner] Add an option to only enable outlining of patterns above a certain threshold
Nathan Lanza via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 26 10:20:49 PDT 2022
lanza created this revision.
lanza added a reviewer: paquette.
Herald added a subscriber: hiraditya.
Herald added a project: All.
lanza requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Outlining isn't always a win when the saved instruction count is >= 1.
The overhead of representing a new function in the binary depends on
exception metadata and alignment. So parameterize this for local tuning.
https://reviews.llvm.org/D136774
Files:
llvm/lib/CodeGen/MachineOutliner.cpp
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<unsigned> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136774.470855.patch
Type: text/x-patch
Size: 1151 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221026/98457629/attachment.bin>
More information about the llvm-commits
mailing list