summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Eubanks <aeubanks@google.com>2023-02-06 13:50:49 -0800
committerArthur Eubanks <aeubanks@google.com>2023-02-09 10:36:58 -0800
commit84728a3d75496ff3f48436f968a01ba2c05ee37e (patch)
treea2ab7503f1bb9bdc96b92ec4928b4e297299d4a1
parentbacf1aa3c0b2c47eb37194a51e2b6edfd5b829f8 (diff)
downloadllvm-84728a3d75496ff3f48436f968a01ba2c05ee37e.tar.gz
[Inliner] Remove legacy simple inliner
It's part of the optimization pipeline, of which the legacy pass manager version is deprecated.
-rw-r--r--llvm/bindings/ocaml/transforms/ipo/ipo_ocaml.c6
-rw-r--r--llvm/bindings/ocaml/transforms/ipo/llvm_ipo.ml3
-rw-r--r--llvm/bindings/ocaml/transforms/ipo/llvm_ipo.mli5
-rw-r--r--llvm/examples/OrcV2Examples/LLJITWithOptimizingIRTransform/LLJITWithOptimizingIRTransform.cpp1
-rw-r--r--llvm/include/llvm-c/Transforms/IPO.h3
-rw-r--r--llvm/include/llvm/InitializePasses.h1
-rw-r--r--llvm/include/llvm/LinkAllPasses.h1
-rw-r--r--llvm/include/llvm/Transforms/IPO.h15
-rw-r--r--llvm/lib/Transforms/IPO/CMakeLists.txt1
-rw-r--r--llvm/lib/Transforms/IPO/IPO.cpp5
-rw-r--r--llvm/lib/Transforms/IPO/InlineSimple.cpp118
-rw-r--r--llvm/lib/Transforms/IPO/PassManagerBuilder.cpp3
-rw-r--r--llvm/test/Bindings/OCaml/ipo.ml1
-rw-r--r--llvm/tools/bugpoint/bugpoint.cpp5
-rw-r--r--llvm/utils/gn/secondary/llvm/lib/Transforms/IPO/BUILD.gn1
-rw-r--r--polly/lib/Transform/Canonicalization.cpp1
16 files changed, 2 insertions, 168 deletions
diff --git a/llvm/bindings/ocaml/transforms/ipo/ipo_ocaml.c b/llvm/bindings/ocaml/transforms/ipo/ipo_ocaml.c
index d93028a05aad..8e263cb71b2b 100644
--- a/llvm/bindings/ocaml/transforms/ipo/ipo_ocaml.c
+++ b/llvm/bindings/ocaml/transforms/ipo/ipo_ocaml.c
@@ -38,12 +38,6 @@ value llvm_add_function_attrs(LLVMPassManagerRef PM) {
}
/* [`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);
return Val_unit;
diff --git a/llvm/bindings/ocaml/transforms/ipo/llvm_ipo.ml b/llvm/bindings/ocaml/transforms/ipo/llvm_ipo.ml
index 553d55cd6ff5..d1ebd56bb05b 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 7177a30770f6..68c772e1c0f2 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 6bd63bf7a7d3..a5fd384b65b5 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 1e280822eb72..f4da3f509fdc 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 8e8f2d38e3c5..a693bc2653a0 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 855f3b9f5e8e..23596304595a 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 51eb50d14ec8..59a659c76cd3 100644
--- a/llvm/include/llvm/Transforms/IPO.h
+++ b/llvm/include/llvm/Transforms/IPO.h
@@ -72,21 +72,6 @@ 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 e68208833f3f..34a1e4c3ebc0 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 4a447bb83de3..6de623f8bff1 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 eba0d6636d6c..000000000000
--- 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 different 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 4afa8fe01e49..93465a350926 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 8517660ace15..6bea990cae98 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 0305f6463858..42d3395c73b1 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 e43a5f476e84..e960be0f3fd6 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 edb8e5ed5841..8cb235f94601 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());