[llvm] 84728a3 - [Inliner] Remove legacy simple inliner
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 9 10:37:11 PST 2023
Author: Arthur Eubanks
Date: 2023-02-09T10:36:58-08:00
New Revision: 84728a3d75496ff3f48436f968a01ba2c05ee37e
URL: https://github.com/llvm/llvm-project/commit/84728a3d75496ff3f48436f968a01ba2c05ee37e
DIFF: https://github.com/llvm/llvm-project/commit/84728a3d75496ff3f48436f968a01ba2c05ee37e.diff
LOG: [Inliner] Remove legacy simple inliner
It's part of the optimization pipeline, of which the legacy pass manager version is deprecated.
Added:
Modified:
llvm/bindings/ocaml/transforms/ipo/ipo_ocaml.c
llvm/bindings/ocaml/transforms/ipo/llvm_ipo.ml
llvm/bindings/ocaml/transforms/ipo/llvm_ipo.mli
llvm/examples/OrcV2Examples/LLJITWithOptimizingIRTransform/LLJITWithOptimizingIRTransform.cpp
llvm/include/llvm-c/Transforms/IPO.h
llvm/include/llvm/InitializePasses.h
llvm/include/llvm/LinkAllPasses.h
llvm/include/llvm/Transforms/IPO.h
llvm/lib/Transforms/IPO/CMakeLists.txt
llvm/lib/Transforms/IPO/IPO.cpp
llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
llvm/test/Bindings/OCaml/ipo.ml
llvm/tools/bugpoint/bugpoint.cpp
llvm/utils/gn/secondary/llvm/lib/Transforms/IPO/BUILD.gn
polly/lib/Transform/Canonicalization.cpp
Removed:
llvm/lib/Transforms/IPO/InlineSimple.cpp
################################################################################
diff --git a/llvm/bindings/ocaml/transforms/ipo/ipo_ocaml.c b/llvm/bindings/ocaml/transforms/ipo/ipo_ocaml.c
index d93028a05aad7..8e263cb71b2b6 100644
--- a/llvm/bindings/ocaml/transforms/ipo/ipo_ocaml.c
+++ b/llvm/bindings/ocaml/transforms/ipo/ipo_ocaml.c
@@ -37,12 +37,6 @@ value llvm_add_function_attrs(LLVMPassManagerRef PM) {
return Val_unit;
}
-/* [`Module] Llvm.PassManager.t -> unit */
-value llvm_add_function_inlining(LLVMPassManagerRef PM) {
- LLVMAddFunctionInliningPass(PM);
- return Val_unit;
-}
-
/* [`Module] Llvm.PassManager.t -> unit */
value llvm_add_always_inliner(LLVMPassManagerRef PM) {
LLVMAddAlwaysInlinerPass(PM);
diff --git a/llvm/bindings/ocaml/transforms/ipo/llvm_ipo.ml b/llvm/bindings/ocaml/transforms/ipo/llvm_ipo.ml
index 553d55cd6ff54..d1ebd56bb05b4 100644
--- a/llvm/bindings/ocaml/transforms/ipo/llvm_ipo.ml
+++ b/llvm/bindings/ocaml/transforms/ipo/llvm_ipo.ml
@@ -15,9 +15,6 @@ external add_dead_arg_elimination
external add_function_attrs
: [ `Module ] Llvm.PassManager.t -> unit
= "llvm_add_function_attrs"
-external add_function_inlining
- : [ `Module ] Llvm.PassManager.t -> unit
- = "llvm_add_function_inlining"
external add_always_inliner
: [ `Module ] Llvm.PassManager.t -> unit
= "llvm_add_always_inliner"
diff --git a/llvm/bindings/ocaml/transforms/ipo/llvm_ipo.mli b/llvm/bindings/ocaml/transforms/ipo/llvm_ipo.mli
index 7177a30770f61..68c772e1c0f2c 100644
--- a/llvm/bindings/ocaml/transforms/ipo/llvm_ipo.mli
+++ b/llvm/bindings/ocaml/transforms/ipo/llvm_ipo.mli
@@ -26,11 +26,6 @@ external add_function_attrs
: [ `Module ] Llvm.PassManager.t -> unit
= "llvm_add_function_attrs"
-(** See the [llvm::createFunctionInliningPass] function. *)
-external add_function_inlining
- : [ `Module ] Llvm.PassManager.t -> unit
- = "llvm_add_function_inlining"
-
(** See the [llvm::createAlwaysInlinerPass] function. *)
external add_always_inliner
: [ `Module ] Llvm.PassManager.t -> unit
diff --git a/llvm/examples/OrcV2Examples/LLJITWithOptimizingIRTransform/LLJITWithOptimizingIRTransform.cpp b/llvm/examples/OrcV2Examples/LLJITWithOptimizingIRTransform/LLJITWithOptimizingIRTransform.cpp
index 6bd63bf7a7d31..a5fd384b65b54 100644
--- a/llvm/examples/OrcV2Examples/LLJITWithOptimizingIRTransform/LLJITWithOptimizingIRTransform.cpp
+++ b/llvm/examples/OrcV2Examples/LLJITWithOptimizingIRTransform/LLJITWithOptimizingIRTransform.cpp
@@ -74,7 +74,6 @@ class MyOptimizationTransform {
public:
MyOptimizationTransform() : PM(std::make_unique<legacy::PassManager>()) {
PM->add(createTailCallEliminationPass());
- PM->add(createFunctionInliningPass());
PM->add(createIndVarSimplifyPass());
PM->add(createCFGSimplificationPass());
}
diff --git a/llvm/include/llvm-c/Transforms/IPO.h b/llvm/include/llvm-c/Transforms/IPO.h
index 1e280822eb723..f4da3f509fdc3 100644
--- a/llvm/include/llvm-c/Transforms/IPO.h
+++ b/llvm/include/llvm-c/Transforms/IPO.h
@@ -36,9 +36,6 @@ void LLVMAddDeadArgEliminationPass(LLVMPassManagerRef PM);
/** See llvm::createFunctionAttrsPass function. */
void LLVMAddFunctionAttrsPass(LLVMPassManagerRef PM);
-/** See llvm::createFunctionInliningPass function. */
-void LLVMAddFunctionInliningPass(LLVMPassManagerRef PM);
-
/** See llvm::createAlwaysInlinerPass function. */
void LLVMAddAlwaysInlinerPass(LLVMPassManagerRef PM);
diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h
index 8e8f2d38e3c51..a693bc2653a0f 100644
--- a/llvm/include/llvm/InitializePasses.h
+++ b/llvm/include/llvm/InitializePasses.h
@@ -362,7 +362,6 @@ void initializeScopedNoAliasAAWrapperPassPass(PassRegistry&);
void initializeSeparateConstOffsetFromGEPLegacyPassPass(PassRegistry &);
void initializeShadowStackGCLoweringPass(PassRegistry&);
void initializeShrinkWrapPass(PassRegistry&);
-void initializeSimpleInlinerPass(PassRegistry&);
void initializeSimpleLoopUnswitchLegacyPassPass(PassRegistry&);
void initializeSingleLoopExtractorPass(PassRegistry&);
void initializeSinkingLegacyPassPass(PassRegistry&);
diff --git a/llvm/include/llvm/LinkAllPasses.h b/llvm/include/llvm/LinkAllPasses.h
index 855f3b9f5e8e8..23596304595a7 100644
--- a/llvm/include/llvm/LinkAllPasses.h
+++ b/llvm/include/llvm/LinkAllPasses.h
@@ -92,7 +92,6 @@ namespace {
(void) llvm::createDomPrinterWrapperPassPass();
(void) llvm::createDomOnlyViewerWrapperPassPass();
(void) llvm::createDomViewerWrapperPassPass();
- (void) llvm::createFunctionInliningPass();
(void) llvm::createAlwaysInlinerLegacyPass();
(void) llvm::createGlobalDCEPass();
(void) llvm::createGlobalOptimizerPass();
diff --git a/llvm/include/llvm/Transforms/IPO.h b/llvm/include/llvm/Transforms/IPO.h
index 51eb50d14ec86..59a659c76cd32 100644
--- a/llvm/include/llvm/Transforms/IPO.h
+++ b/llvm/include/llvm/Transforms/IPO.h
@@ -71,21 +71,6 @@ ModulePass *createEliminateAvailableExternallyPass();
ModulePass *createGVExtractionPass(std::vector<GlobalValue*>& GVs, bool
deleteFn = false, bool keepConstInit = false);
-//===----------------------------------------------------------------------===//
-/// createFunctionInliningPass - Return a new pass object that uses a heuristic
-/// to inline direct function calls to small functions.
-///
-/// The Threshold can be passed directly, or asked to be computed from the
-/// given optimization and size optimization arguments.
-///
-/// The -inline-threshold command line option takes precedence over the
-/// threshold given here.
-Pass *createFunctionInliningPass();
-Pass *createFunctionInliningPass(int Threshold);
-Pass *createFunctionInliningPass(unsigned OptLevel, unsigned SizeOptLevel,
- bool DisableInlineHotCallSite);
-Pass *createFunctionInliningPass(InlineParams &Params);
-
//===----------------------------------------------------------------------===//
/// createDeadArgEliminationPass - This pass removes arguments from functions
/// which are not used by the body of the function.
diff --git a/llvm/lib/Transforms/IPO/CMakeLists.txt b/llvm/lib/Transforms/IPO/CMakeLists.txt
index e68208833f3f2..34a1e4c3ebc0b 100644
--- a/llvm/lib/Transforms/IPO/CMakeLists.txt
+++ b/llvm/lib/Transforms/IPO/CMakeLists.txt
@@ -23,7 +23,6 @@ add_llvm_component_library(LLVMipo
IPO.cpp
IROutliner.cpp
InferFunctionAttrs.cpp
- InlineSimple.cpp
Inliner.cpp
Internalize.cpp
LoopExtractor.cpp
diff --git a/llvm/lib/Transforms/IPO/IPO.cpp b/llvm/lib/Transforms/IPO/IPO.cpp
index 4a447bb83de31..6de623f8bff1a 100644
--- a/llvm/lib/Transforms/IPO/IPO.cpp
+++ b/llvm/lib/Transforms/IPO/IPO.cpp
@@ -33,7 +33,6 @@ void llvm::initializeIPO(PassRegistry &Registry) {
initializeGlobalOptLegacyPassPass(Registry);
initializeGlobalSplitPass(Registry);
initializeAlwaysInlinerLegacyPassPass(Registry);
- initializeSimpleInlinerPass(Registry);
initializeInferFunctionAttrsLegacyPassPass(Registry);
initializeLoopExtractorLegacyPassPass(Registry);
initializeSingleLoopExtractorPass(Registry);
@@ -61,10 +60,6 @@ void LLVMAddFunctionAttrsPass(LLVMPassManagerRef PM) {
unwrap(PM)->add(createPostOrderFunctionAttrsLegacyPass());
}
-void LLVMAddFunctionInliningPass(LLVMPassManagerRef PM) {
- unwrap(PM)->add(createFunctionInliningPass());
-}
-
void LLVMAddAlwaysInlinerPass(LLVMPassManagerRef PM) {
unwrap(PM)->add(llvm::createAlwaysInlinerLegacyPass());
}
diff --git a/llvm/lib/Transforms/IPO/InlineSimple.cpp b/llvm/lib/Transforms/IPO/InlineSimple.cpp
deleted file mode 100644
index eba0d6636d6c0..0000000000000
--- a/llvm/lib/Transforms/IPO/InlineSimple.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-//===- InlineSimple.cpp - Code to perform simple function inlining --------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements bottom-up inlining of functions into callees.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/Analysis/AssumptionCache.h"
-#include "llvm/Analysis/InlineCost.h"
-#include "llvm/Analysis/OptimizationRemarkEmitter.h"
-#include "llvm/Analysis/TargetTransformInfo.h"
-#include "llvm/InitializePasses.h"
-#include "llvm/Transforms/IPO.h"
-#include "llvm/Transforms/IPO/Inliner.h"
-
-using namespace llvm;
-
-#define DEBUG_TYPE "inline"
-
-namespace {
-
-/// Actual inliner pass implementation.
-///
-/// The common implementation of the inlining logic is shared between this
-/// inliner pass and the always inliner pass. The two passes use
diff erent cost
-/// analyses to determine when to inline.
-class SimpleInliner : public LegacyInlinerBase {
-
- InlineParams Params;
-
-public:
- SimpleInliner() : LegacyInlinerBase(ID), Params(llvm::getInlineParams()) {
- initializeSimpleInlinerPass(*PassRegistry::getPassRegistry());
- }
-
- explicit SimpleInliner(InlineParams Params)
- : LegacyInlinerBase(ID), Params(std::move(Params)) {
- initializeSimpleInlinerPass(*PassRegistry::getPassRegistry());
- }
-
- static char ID; // Pass identification, replacement for typeid
-
- InlineCost getInlineCost(CallBase &CB) override {
- Function *Callee = CB.getCalledFunction();
- TargetTransformInfo &TTI = TTIWP->getTTI(*Callee);
-
- bool RemarksEnabled = false;
- const auto &BBs = *CB.getCaller();
- if (!BBs.empty()) {
- auto DI = OptimizationRemark(DEBUG_TYPE, "", DebugLoc(), &BBs.front());
- if (DI.isEnabled())
- RemarksEnabled = true;
- }
- OptimizationRemarkEmitter ORE(CB.getCaller());
-
- std::function<AssumptionCache &(Function &)> GetAssumptionCache =
- [&](Function &F) -> AssumptionCache & {
- return ACT->getAssumptionCache(F);
- };
- return llvm::getInlineCost(CB, Params, TTI, GetAssumptionCache, GetTLI,
- /*GetBFI=*/nullptr, PSI,
- RemarksEnabled ? &ORE : nullptr);
- }
-
- bool runOnSCC(CallGraphSCC &SCC) override;
- void getAnalysisUsage(AnalysisUsage &AU) const override;
-
-private:
- TargetTransformInfoWrapperPass *TTIWP;
-
-};
-
-} // end anonymous namespace
-
-char SimpleInliner::ID = 0;
-INITIALIZE_PASS_BEGIN(SimpleInliner, "inline", "Function Integration/Inlining",
- false, false)
-INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker)
-INITIALIZE_PASS_DEPENDENCY(CallGraphWrapperPass)
-INITIALIZE_PASS_DEPENDENCY(ProfileSummaryInfoWrapperPass)
-INITIALIZE_PASS_DEPENDENCY(TargetTransformInfoWrapperPass)
-INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
-INITIALIZE_PASS_END(SimpleInliner, "inline", "Function Integration/Inlining",
- false, false)
-
-Pass *llvm::createFunctionInliningPass() { return new SimpleInliner(); }
-
-Pass *llvm::createFunctionInliningPass(int Threshold) {
- return new SimpleInliner(llvm::getInlineParams(Threshold));
-}
-
-Pass *llvm::createFunctionInliningPass(unsigned OptLevel,
- unsigned SizeOptLevel,
- bool DisableInlineHotCallSite) {
- auto Param = llvm::getInlineParams(OptLevel, SizeOptLevel);
- if (DisableInlineHotCallSite)
- Param.HotCallSiteThreshold = 0;
- return new SimpleInliner(Param);
-}
-
-Pass *llvm::createFunctionInliningPass(InlineParams &Params) {
- return new SimpleInliner(Params);
-}
-
-bool SimpleInliner::runOnSCC(CallGraphSCC &SCC) {
- TTIWP = &getAnalysis<TargetTransformInfoWrapperPass>();
- return LegacyInlinerBase::runOnSCC(SCC);
-}
-
-void SimpleInliner::getAnalysisUsage(AnalysisUsage &AU) const {
- AU.addRequired<TargetTransformInfoWrapperPass>();
- LegacyInlinerBase::getAnalysisUsage(AU);
-}
diff --git a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
index 4afa8fe01e492..93465a3509267 100644
--- a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
+++ b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
@@ -473,8 +473,7 @@ LLVMPassManagerBuilderSetDisableSimplifyLibCalls(LLVMPassManagerBuilderRef PMB,
void
LLVMPassManagerBuilderUseInlinerWithThreshold(LLVMPassManagerBuilderRef PMB,
unsigned Threshold) {
- PassManagerBuilder *Builder = unwrap(PMB);
- Builder->Inliner = createFunctionInliningPass(Threshold);
+ // TODO: remove this
}
void
diff --git a/llvm/test/Bindings/OCaml/ipo.ml b/llvm/test/Bindings/OCaml/ipo.ml
index 8517660ace156..6bea990cae98b 100644
--- a/llvm/test/Bindings/OCaml/ipo.ml
+++ b/llvm/test/Bindings/OCaml/ipo.ml
@@ -50,7 +50,6 @@ let test_transforms () =
++ add_constant_merge
++ add_dead_arg_elimination
++ add_function_attrs
- ++ add_function_inlining
++ add_always_inliner
++ add_global_dce
++ add_global_optimizer
diff --git a/llvm/tools/bugpoint/bugpoint.cpp b/llvm/tools/bugpoint/bugpoint.cpp
index 0305f64638584..42d3395c73b15 100644
--- a/llvm/tools/bugpoint/bugpoint.cpp
+++ b/llvm/tools/bugpoint/bugpoint.cpp
@@ -121,10 +121,7 @@ static void AddOptimizationPasses(legacy::FunctionPassManager &FPM,
Builder.OptLevel = OptLevel;
Builder.SizeLevel = SizeLevel;
- if (OptLevel > 1)
- Builder.Inliner = createFunctionInliningPass(OptLevel, SizeLevel, false);
- else
- Builder.Inliner = createAlwaysInlinerLegacyPass();
+ Builder.Inliner = createAlwaysInlinerLegacyPass();
Builder.populateFunctionPassManager(FPM);
Builder.populateModulePassManager(FPM);
diff --git a/llvm/utils/gn/secondary/llvm/lib/Transforms/IPO/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/Transforms/IPO/BUILD.gn
index e43a5f476e84a..e960be0f3fd65 100644
--- a/llvm/utils/gn/secondary/llvm/lib/Transforms/IPO/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/lib/Transforms/IPO/BUILD.gn
@@ -44,7 +44,6 @@ static_library("IPO") {
"IPO.cpp",
"IROutliner.cpp",
"InferFunctionAttrs.cpp",
- "InlineSimple.cpp",
"Inliner.cpp",
"Internalize.cpp",
"LoopExtractor.cpp",
diff --git a/polly/lib/Transform/Canonicalization.cpp b/polly/lib/Transform/Canonicalization.cpp
index edb8e5ed58419..8cb235f946018 100644
--- a/polly/lib/Transform/Canonicalization.cpp
+++ b/polly/lib/Transform/Canonicalization.cpp
@@ -50,7 +50,6 @@ void polly::registerCanonicalicationPasses(llvm::legacy::PassManagerBase &PM) {
PM.add(llvm::createReassociatePass());
PM.add(llvm::createLoopRotatePass());
if (PollyInliner) {
- PM.add(llvm::createFunctionInliningPass(200));
PM.add(llvm::createPromoteMemoryToRegisterPass());
PM.add(llvm::createCFGSimplificationPass());
PM.add(llvm::createInstructionCombiningPass());
More information about the llvm-commits
mailing list