Skip to content

Commit e2cd085

Browse files
committed
Recommit "[SCCP] Remove legacy SCCP pass."
This reverts commit a9a1950. The legacy PM uses in Polly have been removed, so recommit the patch. Original message: This is part of the optimization pipeline, of which the legacy pass manager version is deprecated. Reviewed By: aeubanks Differential Revision: https://reviews.llvm.org/D144201
1 parent 6b0cf1e commit e2cd085

File tree

8 files changed

+0
-80
lines changed

8 files changed

+0
-80
lines changed

llvm/bindings/ocaml/transforms/scalar_opts/llvm_scalar_opts.mli

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,6 @@ external add_reassociation
111111
: [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
112112
= "llvm_add_reassociation"
113113

114-
(** See the [llvm::createSCCPPass] function. *)
115-
external add_sccp
116-
: [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
117-
= "llvm_add_sccp"
118-
119114
(** See the [llvm::createSROAPass] function. *)
120115
external add_scalar_repl_aggregation
121116
: [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit

llvm/bindings/ocaml/transforms/scalar_opts/scalar_opts_ocaml.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,6 @@ value llvm_add_reassociation(LLVMPassManagerRef PM) {
139139
return Val_unit;
140140
}
141141

142-
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
143-
value llvm_add_sccp(LLVMPassManagerRef PM) {
144-
LLVMAddSCCPPass(PM);
145-
return Val_unit;
146-
}
147-
148142
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
149143
value llvm_add_scalar_repl_aggregates(LLVMPassManagerRef PM) {
150144
LLVMAddScalarReplAggregatesPass(PM);

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,6 @@ void LLVMAddPartiallyInlineLibCallsPass(LLVMPassManagerRef PM);
9494
/** See llvm::createReassociatePass function. */
9595
void LLVMAddReassociatePass(LLVMPassManagerRef PM);
9696

97-
/** See llvm::createSCCPPass function. */
98-
void LLVMAddSCCPPass(LLVMPassManagerRef PM);
99-
10097
/** See llvm::createSROAPass function. */
10198
void LLVMAddScalarReplAggregatesPass(LLVMPassManagerRef PM);
10299

llvm/include/llvm/LinkAllPasses.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ namespace {
134134
(void) llvm::createRegionOnlyViewerPass();
135135
(void) llvm::createRegionPrinterPass();
136136
(void) llvm::createRegionViewerPass();
137-
(void) llvm::createSCCPPass();
138137
(void) llvm::createSafeStackPass();
139138
(void) llvm::createSROAPass();
140139
(void) llvm::createSingleLoopExtractorPass();

llvm/include/llvm/Transforms/Scalar.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@ class Pass;
3131
//
3232
FunctionPass *createAlignmentFromAssumptionsPass();
3333

34-
//===----------------------------------------------------------------------===//
35-
//
36-
// SCCP - Sparse conditional constant propagation.
37-
//
38-
FunctionPass *createSCCPPass();
39-
4034
//===----------------------------------------------------------------------===//
4135
//
4236
// RedundantDbgInstElimination - This pass removes redundant dbg intrinsics

llvm/lib/Transforms/IPO/PassManagerBuilder.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ void PassManagerBuilder::addFunctionSimplificationPasses(
166166
MPM.add(createMergedLoadStoreMotionPass()); // Merge ld/st in diamonds
167167
MPM.add(createGVNPass(DisableGVNLoadPRE)); // Remove redundancies
168168
}
169-
MPM.add(createSCCPPass()); // Constant prop with SCCP
170169

171170
// Delete dead bit computations (instcombine runs after to fold away the dead
172171
// computations, and then ADCE will run later to exploit any new DCE
@@ -235,7 +234,6 @@ void PassManagerBuilder::addVectorPasses(legacy::PassManagerBase &PM,
235234
.sinkCommonInsts(true)));
236235

237236
if (IsFullLTO) {
238-
PM.add(createSCCPPass()); // Propagate exposed constants
239237
PM.add(createInstructionCombiningPass()); // Clean up again
240238
PM.add(createBitTrackingDCEPass());
241239
}

llvm/lib/Transforms/Scalar/SCCP.cpp

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
#include "llvm/IR/Type.h"
4242
#include "llvm/IR/User.h"
4343
#include "llvm/IR/Value.h"
44-
#include "llvm/InitializePasses.h"
4544
#include "llvm/Pass.h"
4645
#include "llvm/Support/Casting.h"
4746
#include "llvm/Support/Debug.h"
@@ -136,54 +135,3 @@ PreservedAnalyses SCCPPass::run(Function &F, FunctionAnalysisManager &AM) {
136135
PA.preserve<DominatorTreeAnalysis>();
137136
return PA;
138137
}
139-
140-
namespace {
141-
142-
//===--------------------------------------------------------------------===//
143-
//
144-
/// SCCP Class - This class uses the SCCPSolver to implement a per-function
145-
/// Sparse Conditional Constant Propagator.
146-
///
147-
class SCCPLegacyPass : public FunctionPass {
148-
public:
149-
// Pass identification, replacement for typeid
150-
static char ID;
151-
152-
SCCPLegacyPass() : FunctionPass(ID) {
153-
initializeSCCPLegacyPassPass(*PassRegistry::getPassRegistry());
154-
}
155-
156-
void getAnalysisUsage(AnalysisUsage &AU) const override {
157-
AU.addRequired<TargetLibraryInfoWrapperPass>();
158-
AU.addPreserved<GlobalsAAWrapperPass>();
159-
AU.addPreserved<DominatorTreeWrapperPass>();
160-
}
161-
162-
// runOnFunction - Run the Sparse Conditional Constant Propagation
163-
// algorithm, and return true if the function was modified.
164-
bool runOnFunction(Function &F) override {
165-
if (skipFunction(F))
166-
return false;
167-
const DataLayout &DL = F.getParent()->getDataLayout();
168-
const TargetLibraryInfo *TLI =
169-
&getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(F);
170-
auto *DTWP = getAnalysisIfAvailable<DominatorTreeWrapperPass>();
171-
DomTreeUpdater DTU(DTWP ? &DTWP->getDomTree() : nullptr,
172-
DomTreeUpdater::UpdateStrategy::Lazy);
173-
return runSCCP(F, DL, TLI, DTU);
174-
}
175-
};
176-
177-
} // end anonymous namespace
178-
179-
char SCCPLegacyPass::ID = 0;
180-
181-
INITIALIZE_PASS_BEGIN(SCCPLegacyPass, "sccp",
182-
"Sparse Conditional Constant Propagation", false, false)
183-
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
184-
INITIALIZE_PASS_END(SCCPLegacyPass, "sccp",
185-
"Sparse Conditional Constant Propagation", false, false)
186-
187-
// createSCCPPass - This is the public interface to this file.
188-
FunctionPass *llvm::createSCCPPass() { return new SCCPLegacyPass(); }
189-

llvm/lib/Transforms/Scalar/Scalar.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ void llvm::initializeScalarOpts(PassRegistry &Registry) {
8282
initializeRegToMemLegacyPass(Registry);
8383
initializeRewriteStatepointsForGCLegacyPassPass(Registry);
8484
initializeScalarizeMaskedMemIntrinLegacyPassPass(Registry);
85-
initializeSCCPLegacyPassPass(Registry);
8685
initializeSROALegacyPassPass(Registry);
8786
initializeCFGSimplifyPassPass(Registry);
8887
initializeStructurizeCFGLegacyPassPass(Registry);
@@ -191,10 +190,6 @@ void LLVMAddReassociatePass(LLVMPassManagerRef PM) {
191190
unwrap(PM)->add(createReassociatePass());
192191
}
193192

194-
void LLVMAddSCCPPass(LLVMPassManagerRef PM) {
195-
unwrap(PM)->add(createSCCPPass());
196-
}
197-
198193
void LLVMAddScalarReplAggregatesPass(LLVMPassManagerRef PM) {
199194
unwrap(PM)->add(createSROAPass());
200195
}

0 commit comments

Comments
 (0)