Skip to content

Commit 773d663

Browse files
committed
[IPO] Remove various legacy passes
These are part of the optimization pipeline, of which the legacy pass manager version is deprecated and being removed.
1 parent 2e0940c commit 773d663

21 files changed

+1
-482
lines changed

llvm/include/llvm-c/Transforms/IPO.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ LLVM_C_EXTERN_C_BEGIN
2727
* @{
2828
*/
2929

30-
/** See llvm::createConstantMergePass function. */
31-
void LLVMAddConstantMergePass(LLVMPassManagerRef PM);
32-
3330
/** See llvm::createDeadArgEliminationPass function. */
3431
void LLVMAddDeadArgEliminationPass(LLVMPassManagerRef PM);
3532

@@ -39,9 +36,6 @@ void LLVMAddFunctionAttrsPass(LLVMPassManagerRef PM);
3936
/** See llvm::createAlwaysInlinerPass function. */
4037
void LLVMAddAlwaysInlinerPass(LLVMPassManagerRef PM);
4138

42-
/** See llvm::createGlobalDCEPass function. */
43-
void LLVMAddGlobalDCEPass(LLVMPassManagerRef PM);
44-
4539
/**
4640
* @}
4741
*/

llvm/include/llvm/InitializePasses.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ void initializeAssumeBuilderPassLegacyPassPass(PassRegistry &);
6060
void initializeAnnotation2MetadataLegacyPass(PassRegistry &);
6161
void initializeAssumptionCacheTrackerPass(PassRegistry&);
6262
void initializeAtomicExpandPass(PassRegistry&);
63-
void initializeAttributorLegacyPassPass(PassRegistry&);
64-
void initializeAttributorCGSCCLegacyPassPass(PassRegistry &);
6563
void initializeBasicBlockSectionsProfileReaderPass(PassRegistry &);
6664
void initializeBasicBlockSectionsPass(PassRegistry &);
6765
void initializeBDCELegacyPassPass(PassRegistry&);

llvm/include/llvm/LinkAllPasses.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ namespace {
8282
(void) llvm::createCFGSimplificationPass();
8383
(void) llvm::createStructurizeCFGPass();
8484
(void) llvm::createLibCallsShrinkWrapPass();
85-
(void) llvm::createConstantMergePass();
8685
(void) llvm::createCostModelAnalysisPass();
8786
(void) llvm::createDeadArgEliminationPass();
8887
(void) llvm::createDeadCodeEliminationPass();
@@ -93,7 +92,6 @@ namespace {
9392
(void) llvm::createDomOnlyViewerWrapperPassPass();
9493
(void) llvm::createDomViewerWrapperPassPass();
9594
(void) llvm::createAlwaysInlinerLegacyPass();
96-
(void) llvm::createGlobalDCEPass();
9795
(void) llvm::createGlobalsAAWrapperPass();
9896
(void) llvm::createGuardWideningPass();
9997
(void) llvm::createLoopGuardWideningPass();
@@ -154,9 +152,6 @@ namespace {
154152
(void) llvm::createPostDomTree();
155153
(void) llvm::createInstructionNamerPass();
156154
(void) llvm::createMetaRenamerPass();
157-
(void) llvm::createAttributorLegacyPass();
158-
(void) llvm::createAttributorCGSCCLegacyPass();
159-
(void) llvm::createPostOrderFunctionAttrsLegacyPass();
160155
(void) llvm::createMergeICmpsLegacyPass();
161156
(void) llvm::createExpandLargeDivRemPass();
162157
(void) llvm::createExpandMemCmpPass();
@@ -185,7 +180,6 @@ namespace {
185180
(void) llvm::createMustExecutePrinter();
186181
(void) llvm::createMustBeExecutedContextPrinter();
187182
(void) llvm::createFloat2IntPass();
188-
(void) llvm::createEliminateAvailableExternallyPass();
189183
(void)llvm::createScalarizeMaskedMemIntrinLegacyPass();
190184
(void) llvm::createHardwareLoopsLegacyPass();
191185
(void) llvm::createInjectTLIMappingsLegacyPass();

llvm/include/llvm/Transforms/IPO.h

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -27,34 +27,6 @@ class BasicBlock;
2727
class GlobalValue;
2828
class raw_ostream;
2929

30-
//===----------------------------------------------------------------------===//
31-
//
32-
// This pass adds !annotation metadata to entries in the
33-
// @llvm.global.annotations global constant.
34-
//
35-
ModulePass *createAnnotation2MetadataLegacyPass();
36-
37-
//===----------------------------------------------------------------------===//
38-
/// createConstantMergePass - This function returns a new pass that merges
39-
/// duplicate global constants together into a single constant that is shared.
40-
/// This is useful because some passes (ie TraceValues) insert a lot of string
41-
/// constants into the program, regardless of whether or not they duplicate an
42-
/// existing string.
43-
///
44-
ModulePass *createConstantMergePass();
45-
46-
//===----------------------------------------------------------------------===//
47-
/// createGlobalDCEPass - This transform is designed to eliminate unreachable
48-
/// internal globals (functions or global variables)
49-
///
50-
ModulePass *createGlobalDCEPass();
51-
52-
//===----------------------------------------------------------------------===//
53-
/// This transform is designed to eliminate available external globals
54-
/// (functions or global variables)
55-
///
56-
ModulePass *createEliminateAvailableExternallyPass();
57-
5830
//===----------------------------------------------------------------------===//
5931
/// createGVExtractionPass - If deleteFn is true, this pass deletes
6032
/// the specified global values. Otherwise, it deletes as much of the module as

llvm/include/llvm/Transforms/IPO/Attributor.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3223,9 +3223,6 @@ struct AttributorCGSCCPass : public PassInfoMixin<AttributorCGSCCPass> {
32233223
LazyCallGraph &CG, CGSCCUpdateResult &UR);
32243224
};
32253225

3226-
Pass *createAttributorLegacyPass();
3227-
Pass *createAttributorCGSCCLegacyPass();
3228-
32293226
/// Helper function to clamp a state \p S of type \p StateType with the
32303227
/// information in \p R and indicate/return if \p S did change (as-in update is
32313228
/// required to be run again).

llvm/include/llvm/Transforms/IPO/ForceFunctionAttrs.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,13 @@
1717

1818
namespace llvm {
1919
class Module;
20-
class Pass;
2120

2221
/// Pass which forces specific function attributes into the IR, primarily as
2322
/// a debugging tool.
2423
struct ForceFunctionAttrsPass : PassInfoMixin<ForceFunctionAttrsPass> {
2524
PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
2625
};
2726

28-
/// Create a legacy pass manager instance of a pass to force function attrs.
29-
Pass *createForceFunctionAttrsLegacyPass();
30-
3127
}
3228

3329
#endif // LLVM_TRANSFORMS_IPO_FORCEFUNCTIONATTRS_H

llvm/include/llvm/Transforms/IPO/FunctionAttrs.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,6 @@ struct PostOrderFunctionAttrsPass : PassInfoMixin<PostOrderFunctionAttrsPass> {
5252
LazyCallGraph &CG, CGSCCUpdateResult &UR);
5353
};
5454

55-
/// Create a legacy pass manager instance of a pass to compute function attrs
56-
/// in post-order.
57-
Pass *createPostOrderFunctionAttrsLegacyPass();
58-
5955
/// A pass to do RPO deduction and propagation of function attributes.
6056
///
6157
/// This pass provides a general RPO or "top down" propagation of

llvm/include/llvm/Transforms/IPO/InferFunctionAttrs.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,13 @@
1919

2020
namespace llvm {
2121
class Module;
22-
class Pass;
2322

2423
/// A pass which infers function attributes from the names and signatures of
2524
/// function declarations in a module.
2625
struct InferFunctionAttrsPass : PassInfoMixin<InferFunctionAttrsPass> {
2726
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
2827
};
2928

30-
/// Create a legacy pass manager instance of a pass to infer function
31-
/// attributes.
32-
Pass *createInferFunctionAttrsLegacyPass();
33-
3429
}
3530

3631
#endif // LLVM_TRANSFORMS_IPO_INFERFUNCTIONATTRS_H

llvm/lib/Transforms/IPO/Annotation2Metadata.cpp

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -64,34 +64,6 @@ static bool convertAnnotation2Metadata(Module &M) {
6464
return true;
6565
}
6666

67-
namespace {
68-
struct Annotation2MetadataLegacy : public ModulePass {
69-
static char ID;
70-
71-
Annotation2MetadataLegacy() : ModulePass(ID) {
72-
initializeAnnotation2MetadataLegacyPass(*PassRegistry::getPassRegistry());
73-
}
74-
75-
bool runOnModule(Module &M) override { return convertAnnotation2Metadata(M); }
76-
77-
void getAnalysisUsage(AnalysisUsage &AU) const override {
78-
AU.setPreservesAll();
79-
}
80-
};
81-
82-
} // end anonymous namespace
83-
84-
char Annotation2MetadataLegacy::ID = 0;
85-
86-
INITIALIZE_PASS_BEGIN(Annotation2MetadataLegacy, DEBUG_TYPE,
87-
"Annotation2Metadata", false, false)
88-
INITIALIZE_PASS_END(Annotation2MetadataLegacy, DEBUG_TYPE,
89-
"Annotation2Metadata", false, false)
90-
91-
ModulePass *llvm::createAnnotation2MetadataLegacyPass() {
92-
return new Annotation2MetadataLegacy();
93-
}
94-
9567
PreservedAnalyses Annotation2MetadataPass::run(Module &M,
9668
ModuleAnalysisManager &AM) {
9769
convertAnnotation2Metadata(M);

llvm/lib/Transforms/IPO/Attributor.cpp

Lines changed: 0 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -3747,98 +3747,3 @@ template <> struct DOTGraphTraits<AADepGraph *> : public DefaultDOTGraphTraits {
37473747
};
37483748

37493749
} // end namespace llvm
3750-
3751-
namespace {
3752-
3753-
struct AttributorLegacyPass : public ModulePass {
3754-
static char ID;
3755-
3756-
AttributorLegacyPass() : ModulePass(ID) {
3757-
initializeAttributorLegacyPassPass(*PassRegistry::getPassRegistry());
3758-
}
3759-
3760-
bool runOnModule(Module &M) override {
3761-
if (skipModule(M))
3762-
return false;
3763-
3764-
AnalysisGetter AG;
3765-
SetVector<Function *> Functions;
3766-
for (Function &F : M)
3767-
Functions.insert(&F);
3768-
3769-
CallGraphUpdater CGUpdater;
3770-
BumpPtrAllocator Allocator;
3771-
InformationCache InfoCache(M, AG, Allocator, /* CGSCC */ nullptr);
3772-
return runAttributorOnFunctions(InfoCache, Functions, AG, CGUpdater,
3773-
/* DeleteFns*/ true,
3774-
/* IsModulePass */ true);
3775-
}
3776-
3777-
void getAnalysisUsage(AnalysisUsage &AU) const override {
3778-
// FIXME: Think about passes we will preserve and add them here.
3779-
AU.addRequired<TargetLibraryInfoWrapperPass>();
3780-
}
3781-
};
3782-
3783-
struct AttributorCGSCCLegacyPass : public CallGraphSCCPass {
3784-
static char ID;
3785-
3786-
AttributorCGSCCLegacyPass() : CallGraphSCCPass(ID) {
3787-
initializeAttributorCGSCCLegacyPassPass(*PassRegistry::getPassRegistry());
3788-
}
3789-
3790-
bool runOnSCC(CallGraphSCC &SCC) override {
3791-
if (skipSCC(SCC))
3792-
return false;
3793-
3794-
SetVector<Function *> Functions;
3795-
for (CallGraphNode *CGN : SCC)
3796-
if (Function *Fn = CGN->getFunction())
3797-
if (!Fn->isDeclaration())
3798-
Functions.insert(Fn);
3799-
3800-
if (Functions.empty())
3801-
return false;
3802-
3803-
AnalysisGetter AG;
3804-
CallGraph &CG = const_cast<CallGraph &>(SCC.getCallGraph());
3805-
CallGraphUpdater CGUpdater;
3806-
CGUpdater.initialize(CG, SCC);
3807-
Module &M = *Functions.back()->getParent();
3808-
BumpPtrAllocator Allocator;
3809-
InformationCache InfoCache(M, AG, Allocator, /* CGSCC */ &Functions);
3810-
return runAttributorOnFunctions(InfoCache, Functions, AG, CGUpdater,
3811-
/* DeleteFns */ false,
3812-
/* IsModulePass */ false);
3813-
}
3814-
3815-
void getAnalysisUsage(AnalysisUsage &AU) const override {
3816-
// FIXME: Think about passes we will preserve and add them here.
3817-
AU.addRequired<TargetLibraryInfoWrapperPass>();
3818-
CallGraphSCCPass::getAnalysisUsage(AU);
3819-
}
3820-
};
3821-
3822-
} // end anonymous namespace
3823-
3824-
Pass *llvm::createAttributorLegacyPass() { return new AttributorLegacyPass(); }
3825-
Pass *llvm::createAttributorCGSCCLegacyPass() {
3826-
return new AttributorCGSCCLegacyPass();
3827-
}
3828-
3829-
char AttributorLegacyPass::ID = 0;
3830-
char AttributorCGSCCLegacyPass::ID = 0;
3831-
3832-
INITIALIZE_PASS_BEGIN(AttributorLegacyPass, "attributor",
3833-
"Deduce and propagate attributes", false, false)
3834-
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
3835-
INITIALIZE_PASS_END(AttributorLegacyPass, "attributor",
3836-
"Deduce and propagate attributes", false, false)
3837-
INITIALIZE_PASS_BEGIN(AttributorCGSCCLegacyPass, "attributor-cgscc",
3838-
"Deduce and propagate attributes (CGSCC pass)", false,
3839-
false)
3840-
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
3841-
INITIALIZE_PASS_DEPENDENCY(CallGraphWrapperPass)
3842-
INITIALIZE_PASS_END(AttributorCGSCCLegacyPass, "attributor-cgscc",
3843-
"Deduce and propagate attributes (CGSCC pass)", false,
3844-
false)

llvm/lib/Transforms/IPO/ConstantMerge.cpp

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -251,32 +251,3 @@ PreservedAnalyses ConstantMergePass::run(Module &M, ModuleAnalysisManager &) {
251251
return PreservedAnalyses::all();
252252
return PreservedAnalyses::none();
253253
}
254-
255-
namespace {
256-
257-
struct ConstantMergeLegacyPass : public ModulePass {
258-
static char ID; // Pass identification, replacement for typeid
259-
260-
ConstantMergeLegacyPass() : ModulePass(ID) {
261-
initializeConstantMergeLegacyPassPass(*PassRegistry::getPassRegistry());
262-
}
263-
264-
// For this pass, process all of the globals in the module, eliminating
265-
// duplicate constants.
266-
bool runOnModule(Module &M) override {
267-
if (skipModule(M))
268-
return false;
269-
return mergeConstants(M);
270-
}
271-
};
272-
273-
} // end anonymous namespace
274-
275-
char ConstantMergeLegacyPass::ID = 0;
276-
277-
INITIALIZE_PASS(ConstantMergeLegacyPass, "constmerge",
278-
"Merge Duplicate Global Constants", false, false)
279-
280-
ModulePass *llvm::createConstantMergePass() {
281-
return new ConstantMergeLegacyPass();
282-
}

llvm/lib/Transforms/IPO/ElimAvailExtern.cpp

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -70,33 +70,3 @@ EliminateAvailableExternallyPass::run(Module &M, ModuleAnalysisManager &) {
7070
return PreservedAnalyses::all();
7171
return PreservedAnalyses::none();
7272
}
73-
74-
namespace {
75-
76-
struct EliminateAvailableExternallyLegacyPass : public ModulePass {
77-
static char ID; // Pass identification, replacement for typeid
78-
79-
EliminateAvailableExternallyLegacyPass() : ModulePass(ID) {
80-
initializeEliminateAvailableExternallyLegacyPassPass(
81-
*PassRegistry::getPassRegistry());
82-
}
83-
84-
// run - Do the EliminateAvailableExternally pass on the specified module,
85-
// optionally updating the specified callgraph to reflect the changes.
86-
bool runOnModule(Module &M) override {
87-
if (skipModule(M))
88-
return false;
89-
return eliminateAvailableExternally(M);
90-
}
91-
};
92-
93-
} // end anonymous namespace
94-
95-
char EliminateAvailableExternallyLegacyPass::ID = 0;
96-
97-
INITIALIZE_PASS(EliminateAvailableExternallyLegacyPass, "elim-avail-extern",
98-
"Eliminate Available Externally Globals", false, false)
99-
100-
ModulePass *llvm::createEliminateAvailableExternallyPass() {
101-
return new EliminateAvailableExternallyLegacyPass();
102-
}

llvm/lib/Transforms/IPO/ForceFunctionAttrs.cpp

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -80,32 +80,3 @@ PreservedAnalyses ForceFunctionAttrsPass::run(Module &M,
8080
// Just conservatively invalidate analyses, this isn't likely to be important.
8181
return PreservedAnalyses::none();
8282
}
83-
84-
namespace {
85-
struct ForceFunctionAttrsLegacyPass : public ModulePass {
86-
static char ID; // Pass identification, replacement for typeid
87-
ForceFunctionAttrsLegacyPass() : ModulePass(ID) {
88-
initializeForceFunctionAttrsLegacyPassPass(
89-
*PassRegistry::getPassRegistry());
90-
}
91-
92-
bool runOnModule(Module &M) override {
93-
if (!hasForceAttributes())
94-
return false;
95-
96-
for (Function &F : M.functions())
97-
forceAttributes(F);
98-
99-
// Conservatively assume we changed something.
100-
return true;
101-
}
102-
};
103-
}
104-
105-
char ForceFunctionAttrsLegacyPass::ID = 0;
106-
INITIALIZE_PASS(ForceFunctionAttrsLegacyPass, "forceattrs",
107-
"Force set function attributes", false, false)
108-
109-
Pass *llvm::createForceFunctionAttrsLegacyPass() {
110-
return new ForceFunctionAttrsLegacyPass();
111-
}

0 commit comments

Comments
 (0)