From eb5530e621aafedeecafcc25594a6492c0a1e6c3 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Tue, 14 Feb 2023 15:51:09 -0800 Subject: [PATCH] [LoopDistribute] 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/Transforms/Scalar.h | 6 --- .../lib/Transforms/IPO/PassManagerBuilder.cpp | 6 --- llvm/lib/Transforms/Scalar/LoopDistribute.cpp | 54 ------------------- llvm/lib/Transforms/Scalar/Scalar.cpp | 1 - 5 files changed, 68 deletions(-) diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h index 8fa9e1e2948d..e0c1f49893e4 100644 --- a/llvm/include/llvm/InitializePasses.h +++ b/llvm/include/llvm/InitializePasses.h @@ -207,7 +207,6 @@ void initializeLocalizerPass(PassRegistry&); void initializeLoopAccessLegacyAnalysisPass(PassRegistry&); void initializeLoopDataPrefetchLegacyPassPass(PassRegistry&); void initializeLoopDeletionLegacyPassPass(PassRegistry&); -void initializeLoopDistributeLegacyPass(PassRegistry&); void initializeLoopExtractorLegacyPassPass(PassRegistry &); void initializeLoopGuardWideningLegacyPassPass(PassRegistry&); void initializeLoopFuseLegacyPass(PassRegistry&); diff --git a/llvm/include/llvm/Transforms/Scalar.h b/llvm/include/llvm/Transforms/Scalar.h index 8fbe14293114..7bac07f2f1ba 100644 --- a/llvm/include/llvm/Transforms/Scalar.h +++ b/llvm/include/llvm/Transforms/Scalar.h @@ -478,12 +478,6 @@ FunctionPass *createFloat2IntPass(); // FunctionPass *createNaryReassociatePass(); -//===----------------------------------------------------------------------===// -// -// LoopDistribute - Distribute loops. -// -FunctionPass *createLoopDistributePass(); - //===----------------------------------------------------------------------===// // // LoopFuse - Fuse loops. diff --git a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp index 893cca50efc4..42849e940409 100644 --- a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp +++ b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp @@ -389,12 +389,6 @@ void PassManagerBuilder::populateModulePassManager( // on the rotated form. Disable header duplication at -Oz. MPM.add(createLoopRotatePass(SizeLevel == 2 ? 0 : -1, false)); - // Distribute loops to allow partial vectorization. I.e. isolate dependences - // into separate loop that would otherwise inhibit vectorization. This is - // currently only performed for loops marked with the metadata - // llvm.loop.distribute=true or when -enable-loop-distribute is specified. - MPM.add(createLoopDistributePass()); - addVectorPasses(MPM, /* IsFullLTO */ false); // GlobalOpt already deletes dead functions and globals, at -O2 try a diff --git a/llvm/lib/Transforms/Scalar/LoopDistribute.cpp b/llvm/lib/Transforms/Scalar/LoopDistribute.cpp index 7b52b7dca85f..08c0cf789583 100644 --- a/llvm/lib/Transforms/Scalar/LoopDistribute.cpp +++ b/llvm/lib/Transforms/Scalar/LoopDistribute.cpp @@ -995,45 +995,6 @@ static bool runImpl(Function &F, LoopInfo *LI, DominatorTree *DT, return Changed; } -namespace { - -/// The pass class. -class LoopDistributeLegacy : public FunctionPass { -public: - static char ID; - - LoopDistributeLegacy() : FunctionPass(ID) { - // The default is set by the caller. - initializeLoopDistributeLegacyPass(*PassRegistry::getPassRegistry()); - } - - bool runOnFunction(Function &F) override { - if (skipFunction(F)) - return false; - - auto *LI = &getAnalysis().getLoopInfo(); - auto *DT = &getAnalysis().getDomTree(); - auto *SE = &getAnalysis().getSE(); - auto *ORE = &getAnalysis().getORE(); - auto &LAIs = getAnalysis().getLAIs(); - - return runImpl(F, LI, DT, SE, ORE, LAIs); - } - - void getAnalysisUsage(AnalysisUsage &AU) const override { - AU.addRequired(); - AU.addRequired(); - AU.addPreserved(); - AU.addRequired(); - AU.addRequired(); - AU.addPreserved(); - AU.addRequired(); - AU.addPreserved(); - } -}; - -} // end anonymous namespace - PreservedAnalyses LoopDistributePass::run(Function &F, FunctionAnalysisManager &AM) { auto &LI = AM.getResult(F); @@ -1050,18 +1011,3 @@ PreservedAnalyses LoopDistributePass::run(Function &F, PA.preserve(); return PA; } - -char LoopDistributeLegacy::ID; - -static const char ldist_name[] = "Loop Distribution"; - -INITIALIZE_PASS_BEGIN(LoopDistributeLegacy, LDIST_NAME, ldist_name, false, - false) -INITIALIZE_PASS_DEPENDENCY(LoopInfoWrapperPass) -INITIALIZE_PASS_DEPENDENCY(LoopAccessLegacyAnalysis) -INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass) -INITIALIZE_PASS_DEPENDENCY(ScalarEvolutionWrapperPass) -INITIALIZE_PASS_DEPENDENCY(OptimizationRemarkEmitterWrapperPass) -INITIALIZE_PASS_END(LoopDistributeLegacy, LDIST_NAME, ldist_name, false, false) - -FunctionPass *llvm::createLoopDistributePass() { return new LoopDistributeLegacy(); } diff --git a/llvm/lib/Transforms/Scalar/Scalar.cpp b/llvm/lib/Transforms/Scalar/Scalar.cpp index e4a58b126537..11f819eb4b6e 100644 --- a/llvm/lib/Transforms/Scalar/Scalar.cpp +++ b/llvm/lib/Transforms/Scalar/Scalar.cpp @@ -104,7 +104,6 @@ void llvm::initializeScalarOpts(PassRegistry &Registry) { initializePlaceBackedgeSafepointsImplPass(Registry); initializePlaceSafepointsPass(Registry); initializeFloat2IntLegacyPassPass(Registry); - initializeLoopDistributeLegacyPass(Registry); initializeLoopLoadEliminationPass(Registry); initializeLoopSimplifyCFGLegacyPassPass(Registry); initializeLoopVersioningLegacyPassPass(Registry); -- 2.34.1