From a409f3c069145547db204099676c643ccd8b30d7 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Tue, 14 Feb 2023 21:40:45 -0800 Subject: [PATCH] [LoopVersioningLICM] Remove legacy pass Following recent changes to remove non-core features of the legacy PM/optimization pipeline. --- llvm/include/llvm/InitializePasses.h | 1 - llvm/include/llvm/LinkAllPasses.h | 1 - llvm/include/llvm/Transforms/Scalar.h | 6 --- llvm/lib/Transforms/Scalar/LoopVersioningLICM.cpp | 62 ----------------------- llvm/lib/Transforms/Scalar/Scalar.cpp | 1 - 5 files changed, 71 deletions(-) diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h index 665b29b..e51c712 100644 --- a/llvm/include/llvm/InitializePasses.h +++ b/llvm/include/llvm/InitializePasses.h @@ -224,7 +224,6 @@ void initializeLoopSimplifyPass(PassRegistry&); void initializeLoopStrengthReducePass(PassRegistry&); void initializeLoopUnrollPass(PassRegistry&); void initializeLoopVectorizePass(PassRegistry&); -void initializeLoopVersioningLICMLegacyPassPass(PassRegistry &); void initializeLowerAtomicLegacyPassPass(PassRegistry&); void initializeLowerConstantIntrinsicsPass(PassRegistry&); void initializeLowerEmuTLSPass(PassRegistry&); diff --git a/llvm/include/llvm/LinkAllPasses.h b/llvm/include/llvm/LinkAllPasses.h index d6e4cb2..fe698e2 100644 --- a/llvm/include/llvm/LinkAllPasses.h +++ b/llvm/include/llvm/LinkAllPasses.h @@ -116,7 +116,6 @@ namespace { (void) llvm::createLoopStrengthReducePass(); (void) llvm::createLoopRerollPass(); (void) llvm::createLoopUnrollPass(); - (void) llvm::createLoopVersioningLICMPass(); (void) llvm::createLoopIdiomPass(); (void) llvm::createLoopRotatePass(); (void) llvm::createLowerConstantIntrinsicsPass(); diff --git a/llvm/include/llvm/Transforms/Scalar.h b/llvm/include/llvm/Transforms/Scalar.h index 5e3ced5..c70a814 100644 --- a/llvm/include/llvm/Transforms/Scalar.h +++ b/llvm/include/llvm/Transforms/Scalar.h @@ -203,12 +203,6 @@ Pass *createLoopIdiomPass(); //===----------------------------------------------------------------------===// // -// LoopVersioningLICM - This pass is a loop versioning pass for LICM. -// -Pass *createLoopVersioningLICMPass(); - -//===----------------------------------------------------------------------===// -// // DemoteRegisterToMemoryPass - This pass is used to demote registers to memory // references. In basically undoes the PromoteMemoryToRegister pass to make cfg // hacking easier. diff --git a/llvm/lib/Transforms/Scalar/LoopVersioningLICM.cpp b/llvm/lib/Transforms/Scalar/LoopVersioningLICM.cpp index 848be25..c5b08cb 100644 --- a/llvm/lib/Transforms/Scalar/LoopVersioningLICM.cpp +++ b/llvm/lib/Transforms/Scalar/LoopVersioningLICM.cpp @@ -113,33 +113,6 @@ static cl::opt LVLoopDepthThreshold( namespace { -struct LoopVersioningLICMLegacyPass : public LoopPass { - static char ID; - - LoopVersioningLICMLegacyPass() : LoopPass(ID) { - initializeLoopVersioningLICMLegacyPassPass( - *PassRegistry::getPassRegistry()); - } - - bool runOnLoop(Loop *L, LPPassManager &LPM) override; - - StringRef getPassName() const override { return "Loop Versioning for LICM"; } - - void getAnalysisUsage(AnalysisUsage &AU) const override { - AU.setPreservesCFG(); - AU.addRequired(); - AU.addRequired(); - AU.addRequiredID(LCSSAID); - AU.addRequired(); - AU.addRequired(); - AU.addRequiredID(LoopSimplifyID); - AU.addRequired(); - AU.addPreserved(); - AU.addPreserved(); - AU.addRequired(); - } -}; - struct LoopVersioningLICM { // We don't explicitly pass in LoopAccessInfo to the constructor since the // loop versioning might return early due to instructions that are not safe @@ -563,21 +536,6 @@ void LoopVersioningLICM::setNoAliasToLoop(Loop *VerLoop) { } } -bool LoopVersioningLICMLegacyPass::runOnLoop(Loop *L, LPPassManager &LPM) { - if (skipLoop(L)) - return false; - - AliasAnalysis *AA = &getAnalysis().getAAResults(); - ScalarEvolution *SE = &getAnalysis().getSE(); - OptimizationRemarkEmitter *ORE = - &getAnalysis().getORE(); - LoopInfo &LI = getAnalysis().getLoopInfo(); - DominatorTree *DT = &getAnalysis().getDomTree(); - auto &LAIs = getAnalysis().getLAIs(); - - return LoopVersioningLICM(AA, SE, ORE, LAIs, LI, L).run(DT); -} - bool LoopVersioningLICM::run(DominatorTree *DT) { // Do not do the transformation if disabled by metadata. if (hasLICMVersioningTransformation(CurLoop) & TM_Disable) @@ -611,26 +569,6 @@ bool LoopVersioningLICM::run(DominatorTree *DT) { return Changed; } -char LoopVersioningLICMLegacyPass::ID = 0; - -INITIALIZE_PASS_BEGIN(LoopVersioningLICMLegacyPass, "loop-versioning-licm", - "Loop Versioning For LICM", false, false) -INITIALIZE_PASS_DEPENDENCY(AAResultsWrapperPass) -INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass) -INITIALIZE_PASS_DEPENDENCY(GlobalsAAWrapperPass) -INITIALIZE_PASS_DEPENDENCY(LCSSAWrapperPass) -INITIALIZE_PASS_DEPENDENCY(LoopAccessLegacyAnalysis) -INITIALIZE_PASS_DEPENDENCY(LoopInfoWrapperPass) -INITIALIZE_PASS_DEPENDENCY(LoopSimplify) -INITIALIZE_PASS_DEPENDENCY(ScalarEvolutionWrapperPass) -INITIALIZE_PASS_DEPENDENCY(OptimizationRemarkEmitterWrapperPass) -INITIALIZE_PASS_END(LoopVersioningLICMLegacyPass, "loop-versioning-licm", - "Loop Versioning For LICM", false, false) - -Pass *llvm::createLoopVersioningLICMPass() { - return new LoopVersioningLICMLegacyPass(); -} - namespace llvm { PreservedAnalyses LoopVersioningLICMPass::run(Loop &L, LoopAnalysisManager &AM, diff --git a/llvm/lib/Transforms/Scalar/Scalar.cpp b/llvm/lib/Transforms/Scalar/Scalar.cpp index 3b1531f..cff6b2f 100644 --- a/llvm/lib/Transforms/Scalar/Scalar.cpp +++ b/llvm/lib/Transforms/Scalar/Scalar.cpp @@ -70,7 +70,6 @@ void llvm::initializeScalarOpts(PassRegistry &Registry) { initializeLoopStrengthReducePass(Registry); initializeLoopRerollLegacyPassPass(Registry); initializeLoopUnrollPass(Registry); - initializeLoopVersioningLICMLegacyPassPass(Registry); initializeLoopIdiomRecognizeLegacyPassPass(Registry); initializeLowerAtomicLegacyPassPass(Registry); initializeLowerConstantIntrinsicsPass(Registry); -- 2.7.4