Add callback to not run inliner passes for OptLevel <= 1

Inliner passes disabled with the callback:

- ModuleInlinerWrapperPass
- InlineAdvisorAnalysisPrinterPass
- PartialInlinerPass
- buildInlinerPipeline
- ModuleInlinerPass
- InlinerPass
- InlineAdvisorAnalysis
- PartiallyInlineLibCallsPass
- InlineCostAnnotationPrinterPass
- InlineSizeEstimatorAnalysisPrinterPass
- InlineSizeEstimatorAnalysis
This commit is contained in:
Devajth Valaparambil Sreeramaswamy 2024-01-12 10:21:38 +01:00 committed by jenkins
parent 80b69f0737
commit c444493f27

View File

@ -369,6 +369,22 @@ void BackendPasses::CreatePasses(int OptLevel, llvm::ModulePassManager& MPM,
// At O0 and O1 we only run the always inliner which is more efficient. At
// higher optimization levels we run the normal inliner.
MPM.addPass(AlwaysInlinerPass());
// Register a callback for disabling all other inliner passes.
PIC.registerShouldRunOptionalPassCallback([](StringRef P, Any) {
if (P.equals("ModuleInlinerWrapperPass") ||
P.equals("InlineAdvisorAnalysisPrinterPass") ||
P.equals("PartialInlinerPass") || P.equals("buildInlinerPipeline") ||
P.equals("ModuleInlinerPass") || P.equals("InlinerPass") ||
P.equals("InlineAdvisorAnalysis") ||
P.equals("PartiallyInlineLibCallsPass") ||
P.equals("InlineCostAnnotationPrinterPass") ||
P.equals("InlineSizeEstimatorAnalysisPrinterPass") ||
P.equals("InlineSizeEstimatorAnalysis"))
return false;
return true;
});
}
SI.registerCallbacks(PIC, &FAM);