[llvm] 4fa3280 - [NewPM][Pipeline] Add PipelineTuningOption to set inliner threshold
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 2 10:48:02 PDT 2022
Author: Arthur Eubanks
Date: 2022-11-02T10:47:51-07:00
New Revision: 4fa328074efd7eefdbb314b8f6e9f855e443ca20
URL: https://github.com/llvm/llvm-project/commit/4fa328074efd7eefdbb314b8f6e9f855e443ca20
DIFF: https://github.com/llvm/llvm-project/commit/4fa328074efd7eefdbb314b8f6e9f855e443ca20.diff
LOG: [NewPM][Pipeline] Add PipelineTuningOption to set inliner threshold
The legacy PM allowed you to set a custom inliner threshold via
builder.Inliner = llvm::createFunctionInliningPass(inline_threshold);
This allows the same thing to be done with the new PM optimization pipelines.
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D137038
Added:
Modified:
llvm/include/llvm/Passes/PassBuilder.h
llvm/lib/Passes/PassBuilderPipelines.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Passes/PassBuilder.h b/llvm/include/llvm/Passes/PassBuilder.h
index 68f07f39afa63..d7d76c30d1a6b 100644
--- a/llvm/include/llvm/Passes/PassBuilder.h
+++ b/llvm/include/llvm/Passes/PassBuilder.h
@@ -75,6 +75,9 @@ class PipelineTuningOptions {
/// false.
bool MergeFunctions;
+ /// Tuning option to override the default inliner threshold.
+ int InlinerThreshold;
+
// Experimental option to eagerly invalidate more analyses. This has the
// potential to decrease max memory usage in exchange for more compile time.
// This may affect codegen due to either passes using analyses only when
diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp
index 4f1ef22775db8..b32d53d8dfaf8 100644
--- a/llvm/lib/Passes/PassBuilderPipelines.cpp
+++ b/llvm/lib/Passes/PassBuilderPipelines.cpp
@@ -200,6 +200,7 @@ PipelineTuningOptions::PipelineTuningOptions() {
LicmMssaNoAccForPromotionCap = SetLicmMssaNoAccForPromotionCap;
CallGraphProfile = true;
MergeFunctions = EnableMergeFunctions;
+ InlinerThreshold = -1;
EagerlyInvalidateAnalyses = EnableEagerlyInvalidateAnalyses;
}
@@ -719,7 +720,11 @@ static InlineParams getInlineParamsFromOptLevel(OptimizationLevel Level) {
ModuleInlinerWrapperPass
PassBuilder::buildInlinerPipeline(OptimizationLevel Level,
ThinOrFullLTOPhase Phase) {
- InlineParams IP = getInlineParamsFromOptLevel(Level);
+ InlineParams IP;
+ if (PTO.InlinerThreshold == -1)
+ IP = getInlineParamsFromOptLevel(Level);
+ else
+ IP = getInlineParams(PTO.InlinerThreshold);
// For PreLinkThinLTO + SamplePGO, set hot-caller threshold to 0 to
// disable hot callsite inline (as much as possible [1]) because it makes
// profile annotation in the backend inaccurate.
More information about the llvm-commits
mailing list