[llvm] c972ed4 - [MergeFunctions] Remove legacy pass
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 6 13:14:08 PST 2023
Author: Arthur Eubanks
Date: 2023-02-06T13:11:08-08:00
New Revision: c972ed4d34eb4660ce25b32fdf44a789bd7d76bf
URL: https://github.com/llvm/llvm-project/commit/c972ed4d34eb4660ce25b32fdf44a789bd7d76bf
DIFF: https://github.com/llvm/llvm-project/commit/c972ed4d34eb4660ce25b32fdf44a789bd7d76bf.diff
LOG: [MergeFunctions] Remove legacy pass
It's part of the optimization pipeline, 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/include/llvm-c/Transforms/IPO.h
llvm/include/llvm/InitializePasses.h
llvm/include/llvm/LinkAllPasses.h
llvm/include/llvm/Transforms/IPO.h
llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h
llvm/lib/Transforms/IPO/IPO.cpp
llvm/lib/Transforms/IPO/MergeFunctions.cpp
llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
Removed:
################################################################################
diff --git a/llvm/bindings/ocaml/transforms/ipo/ipo_ocaml.c b/llvm/bindings/ocaml/transforms/ipo/ipo_ocaml.c
index 8d6e57e74467..35d296f54e85 100644
--- a/llvm/bindings/ocaml/transforms/ipo/ipo_ocaml.c
+++ b/llvm/bindings/ocaml/transforms/ipo/ipo_ocaml.c
@@ -25,12 +25,6 @@ value llvm_add_constant_merge(LLVMPassManagerRef PM) {
return Val_unit;
}
-/* [`Module] Llvm.PassManager.t -> unit */
-value llvm_add_merge_functions(LLVMPassManagerRef PM) {
- LLVMAddMergeFunctionsPass(PM);
- return Val_unit;
-}
-
/* [`Module] Llvm.PassManager.t -> unit */
value llvm_add_dead_arg_elimination(LLVMPassManagerRef PM) {
LLVMAddDeadArgEliminationPass(PM);
diff --git a/llvm/bindings/ocaml/transforms/ipo/llvm_ipo.ml b/llvm/bindings/ocaml/transforms/ipo/llvm_ipo.ml
index 99b79e532ee9..7bbebe459bb7 100644
--- a/llvm/bindings/ocaml/transforms/ipo/llvm_ipo.ml
+++ b/llvm/bindings/ocaml/transforms/ipo/llvm_ipo.ml
@@ -9,9 +9,6 @@
external add_constant_merge
: [ `Module ] Llvm.PassManager.t -> unit
= "llvm_add_constant_merge"
-external add_merge_functions
- : [ `Module ] Llvm.PassManager.t -> unit
- = "llvm_add_merge_functions"
external add_dead_arg_elimination
: [ `Module ] Llvm.PassManager.t -> unit
= "llvm_add_dead_arg_elimination"
diff --git a/llvm/bindings/ocaml/transforms/ipo/llvm_ipo.mli b/llvm/bindings/ocaml/transforms/ipo/llvm_ipo.mli
index f8612b17823e..c37ab2e8266f 100644
--- a/llvm/bindings/ocaml/transforms/ipo/llvm_ipo.mli
+++ b/llvm/bindings/ocaml/transforms/ipo/llvm_ipo.mli
@@ -16,11 +16,6 @@ external add_constant_merge
: [ `Module ] Llvm.PassManager.t -> unit
= "llvm_add_constant_merge"
-(** See the [llvm::createMergeFunctionsPass] function. *)
-external add_merge_functions
- : [ `Module ] Llvm.PassManager.t -> unit
- = "llvm_add_merge_functions"
-
(** See the [llvm::createDeadArgEliminationPass] function. *)
external add_dead_arg_elimination
: [ `Module ] Llvm.PassManager.t -> unit
diff --git a/llvm/include/llvm-c/Transforms/IPO.h b/llvm/include/llvm-c/Transforms/IPO.h
index b049e9e67f34..06a342dff3fe 100644
--- a/llvm/include/llvm-c/Transforms/IPO.h
+++ b/llvm/include/llvm-c/Transforms/IPO.h
@@ -30,9 +30,6 @@ LLVM_C_EXTERN_C_BEGIN
/** See llvm::createConstantMergePass function. */
void LLVMAddConstantMergePass(LLVMPassManagerRef PM);
-/** See llvm::createMergeFunctionsPass function. */
-void LLVMAddMergeFunctionsPass(LLVMPassManagerRef PM);
-
/** See llvm::createCalledValuePropagationPass function. */
void LLVMAddCalledValuePropagationPass(LLVMPassManagerRef PM);
diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h
index 1164cd872eb9..620d1423d2b9 100644
--- a/llvm/include/llvm/InitializePasses.h
+++ b/llvm/include/llvm/InitializePasses.h
@@ -286,7 +286,6 @@ void initializeMemDerefPrinterPass(PassRegistry&);
void initializeMemoryDependenceWrapperPassPass(PassRegistry&);
void initializeMemorySSAPrinterLegacyPassPass(PassRegistry&);
void initializeMemorySSAWrapperPassPass(PassRegistry&);
-void initializeMergeFunctionsLegacyPassPass(PassRegistry&);
void initializeMergeICmpsLegacyPassPass(PassRegistry &);
void initializeMergedLoadStoreMotionLegacyPassPass(PassRegistry&);
void initializeMetaRenamerPass(PassRegistry&);
diff --git a/llvm/include/llvm/LinkAllPasses.h b/llvm/include/llvm/LinkAllPasses.h
index c76d7adcbc27..ff2aa6764147 100644
--- a/llvm/include/llvm/LinkAllPasses.h
+++ b/llvm/include/llvm/LinkAllPasses.h
@@ -175,7 +175,6 @@ namespace {
(void) llvm::createAttributorCGSCCLegacyPass();
(void) llvm::createPostOrderFunctionAttrsLegacyPass();
(void) llvm::createReversePostOrderFunctionAttrsPass();
- (void) llvm::createMergeFunctionsPass();
(void) llvm::createMergeICmpsLegacyPass();
(void) llvm::createExpandLargeDivRemPass();
(void) llvm::createExpandMemCmpPass();
diff --git a/llvm/include/llvm/Transforms/IPO.h b/llvm/include/llvm/Transforms/IPO.h
index 9b1a2fb362f2..a14b16d50810 100644
--- a/llvm/include/llvm/Transforms/IPO.h
+++ b/llvm/include/llvm/Transforms/IPO.h
@@ -169,12 +169,6 @@ ModulePass *createStripDeadPrototypesPass();
///
Pass *createReversePostOrderFunctionAttrsPass();
-//===----------------------------------------------------------------------===//
-/// createMergeFunctionsPass - This pass discovers identical functions and
-/// collapses them.
-///
-ModulePass *createMergeFunctionsPass();
-
//===----------------------------------------------------------------------===//
/// createHotColdSplittingPass - This pass outlines cold blocks into a separate
/// function(s).
diff --git a/llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h b/llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h
index 4cc161e03df9..3930cb8a0e05 100644
--- a/llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h
+++ b/llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h
@@ -99,7 +99,6 @@ class PassManagerBuilder {
bool ForgetAllSCEVInLoopUnroll;
bool VerifyInput;
bool VerifyOutput;
- bool MergeFunctions;
bool DivergentTarget;
unsigned LicmMssaOptCap;
unsigned LicmMssaNoAccForPromotionCap;
diff --git a/llvm/lib/Transforms/IPO/IPO.cpp b/llvm/lib/Transforms/IPO/IPO.cpp
index 4163c448dc8f..b9cc4d011381 100644
--- a/llvm/lib/Transforms/IPO/IPO.cpp
+++ b/llvm/lib/Transforms/IPO/IPO.cpp
@@ -41,7 +41,6 @@ void llvm::initializeIPO(PassRegistry &Registry) {
initializeInternalizeLegacyPassPass(Registry);
initializeLoopExtractorLegacyPassPass(Registry);
initializeSingleLoopExtractorPass(Registry);
- initializeMergeFunctionsLegacyPassPass(Registry);
initializePartialInlinerLegacyPassPass(Registry);
initializeAttributorLegacyPassPass(Registry);
initializeAttributorCGSCCLegacyPassPass(Registry);
@@ -97,10 +96,6 @@ void LLVMAddIPSCCPPass(LLVMPassManagerRef PM) {
unwrap(PM)->add(createIPSCCPPass());
}
-void LLVMAddMergeFunctionsPass(LLVMPassManagerRef PM) {
- unwrap(PM)->add(createMergeFunctionsPass());
-}
-
void LLVMAddInternalizePass(LLVMPassManagerRef PM, unsigned AllButMain) {
auto PreserveMain = [=](const GlobalValue &GV) {
return AllButMain && GV.getName() == "main";
diff --git a/llvm/lib/Transforms/IPO/MergeFunctions.cpp b/llvm/lib/Transforms/IPO/MergeFunctions.cpp
index 590f62ca58dd..bd2db5df754e 100644
--- a/llvm/lib/Transforms/IPO/MergeFunctions.cpp
+++ b/llvm/lib/Transforms/IPO/MergeFunctions.cpp
@@ -294,34 +294,8 @@ class MergeFunctions {
// there is exactly one mapping F -> FN for each FunctionNode FN in FnTree.
DenseMap<AssertingVH<Function>, FnTreeType::iterator> FNodesInTree;
};
-
-class MergeFunctionsLegacyPass : public ModulePass {
-public:
- static char ID;
-
- MergeFunctionsLegacyPass(): ModulePass(ID) {
- initializeMergeFunctionsLegacyPassPass(*PassRegistry::getPassRegistry());
- }
-
- bool runOnModule(Module &M) override {
- if (skipModule(M))
- return false;
-
- MergeFunctions MF;
- return MF.runOnModule(M);
- }
-};
-
} // end anonymous namespace
-char MergeFunctionsLegacyPass::ID = 0;
-INITIALIZE_PASS(MergeFunctionsLegacyPass, "mergefunc",
- "Merge Functions", false, false)
-
-ModulePass *llvm::createMergeFunctionsPass() {
- return new MergeFunctionsLegacyPass();
-}
-
PreservedAnalyses MergeFunctionsPass::run(Module &M,
ModuleAnalysisManager &AM) {
MergeFunctions MF;
diff --git a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
index 6b91c8494f39..4653e7bb9706 100644
--- a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
+++ b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
@@ -56,7 +56,6 @@ PassManagerBuilder::PassManagerBuilder() {
ForgetAllSCEVInLoopUnroll = ForgetSCEVInLoopUnroll;
VerifyInput = false;
VerifyOutput = false;
- MergeFunctions = false;
DivergentTarget = false;
CallGraphProfile = true;
}
@@ -302,13 +301,6 @@ void PassManagerBuilder::populateModulePassManager(
Inliner = nullptr;
}
- // FIXME: The BarrierNoopPass is a HACK! The inliner pass above implicitly
- // creates a CGSCC pass manager, but we don't want to add extensions into
- // that pass manager. To prevent this we insert a no-op module pass to reset
- // the pass manager to get the same behavior as EP_OptimizerLast in non-O0
- // builds. The function merging pass is
- if (MergeFunctions)
- MPM.add(createMergeFunctionsPass());
return;
}
@@ -428,9 +420,6 @@ void PassManagerBuilder::populateModulePassManager(
MPM.add(createConstantMergePass()); // Merge dup global constants
}
- if (MergeFunctions)
- MPM.add(createMergeFunctionsPass());
-
// LoopSink pass sinks instructions hoisted by LICM, which serves as a
// canonicalization pass that enables other optimizations. As a result,
// LoopSink pass needs to be a very late IR pass to avoid undoing LICM
More information about the llvm-commits
mailing list