diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h --- a/llvm/include/llvm/InitializePasses.h +++ b/llvm/include/llvm/InitializePasses.h @@ -147,7 +147,6 @@ void initializeHardwareLoopsLegacyPass(PassRegistry&); void initializeMIRProfileLoaderPassPass(PassRegistry &); void initializeIPSCCPLegacyPassPass(PassRegistry&); -void initializeIRCELegacyPassPass(PassRegistry&); void initializeIRSimilarityIdentifierWrapperPassPass(PassRegistry&); void initializeIRTranslatorPass(PassRegistry&); void initializeIVUsersWrapperPassPass(PassRegistry&); diff --git a/llvm/include/llvm/LinkAllPasses.h b/llvm/include/llvm/LinkAllPasses.h --- a/llvm/include/llvm/LinkAllPasses.h +++ b/llvm/include/llvm/LinkAllPasses.h @@ -90,7 +90,6 @@ (void) llvm::createGlobalsAAWrapperPass(); (void) llvm::createGuardWideningPass(); (void) llvm::createLoopGuardWideningPass(); - (void) llvm::createInductiveRangeCheckEliminationPass(); (void) llvm::createInstSimplifyLegacyPass(); (void) llvm::createInstructionCombiningPass(); (void) llvm::createJMCInstrumenterPass(); diff --git a/llvm/include/llvm/Transforms/Scalar.h b/llvm/include/llvm/Transforms/Scalar.h --- a/llvm/include/llvm/Transforms/Scalar.h +++ b/llvm/include/llvm/Transforms/Scalar.h @@ -72,13 +72,6 @@ // FunctionPass *createSROAPass(bool PreserveCFG = true); -//===----------------------------------------------------------------------===// -// -// InductiveRangeCheckElimination - Transform loops to elide range checks on -// linear functions of the induction variable. -// -Pass *createInductiveRangeCheckEliminationPass(); - //===----------------------------------------------------------------------===// // // LICM - This pass is a loop invariant code motion and memory promotion pass. diff --git a/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp b/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp --- a/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp +++ b/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp @@ -72,8 +72,6 @@ #include "llvm/IR/Use.h" #include "llvm/IR/User.h" #include "llvm/IR/Value.h" -#include "llvm/InitializePasses.h" -#include "llvm/Pass.h" #include "llvm/Support/BranchProbability.h" #include "llvm/Support/Casting.h" #include "llvm/Support/CommandLine.h" @@ -249,40 +247,8 @@ bool run(Loop *L, function_ref LPMAddNewLoop); }; -class IRCELegacyPass : public FunctionPass { -public: - static char ID; - - IRCELegacyPass() : FunctionPass(ID) { - initializeIRCELegacyPassPass(*PassRegistry::getPassRegistry()); - } - - void getAnalysisUsage(AnalysisUsage &AU) const override { - AU.addRequired(); - AU.addRequired(); - AU.addPreserved(); - AU.addRequired(); - AU.addPreserved(); - AU.addRequired(); - AU.addPreserved(); - } - - bool runOnFunction(Function &F) override; -}; - } // end anonymous namespace -char IRCELegacyPass::ID = 0; - -INITIALIZE_PASS_BEGIN(IRCELegacyPass, "irce", - "Inductive range check elimination", false, false) -INITIALIZE_PASS_DEPENDENCY(BranchProbabilityInfoWrapperPass) -INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass) -INITIALIZE_PASS_DEPENDENCY(LoopInfoWrapperPass) -INITIALIZE_PASS_DEPENDENCY(ScalarEvolutionWrapperPass) -INITIALIZE_PASS_END(IRCELegacyPass, "irce", "Inductive range check elimination", - false, false) - /// Parse a single ICmp instruction, `ICI`, into a range check. If `ICI` cannot /// be interpreted as a range check, return false and set `Index` and `End` /// to `nullptr`. Otherwise set `Index` to the SCEV being range checked, and @@ -1826,39 +1792,6 @@ return getLoopPassPreservedAnalyses(); } -bool IRCELegacyPass::runOnFunction(Function &F) { - if (skipFunction(F)) - return false; - - ScalarEvolution &SE = getAnalysis().getSE(); - BranchProbabilityInfo &BPI = - getAnalysis().getBPI(); - auto &DT = getAnalysis().getDomTree(); - auto &LI = getAnalysis().getLoopInfo(); - InductiveRangeCheckElimination IRCE(SE, &BPI, DT, LI); - - bool Changed = false; - - for (const auto &L : LI) { - Changed |= simplifyLoop(L, &DT, &LI, &SE, nullptr, nullptr, - /*PreserveLCSSA=*/false); - Changed |= formLCSSARecursively(*L, DT, &LI, &SE); - } - - SmallPriorityWorklist Worklist; - appendLoopsToWorklist(LI, Worklist); - auto LPMAddNewLoop = [&](Loop *NL, bool IsSubloop) { - if (!IsSubloop) - appendLoopsToWorklist(*NL, Worklist); - }; - - while (!Worklist.empty()) { - Loop *L = Worklist.pop_back_val(); - Changed |= IRCE.run(L, LPMAddNewLoop); - } - return Changed; -} - bool InductiveRangeCheckElimination::isProfitableToTransform(const Loop &L, LoopStructure &LS) { @@ -1998,7 +1931,3 @@ return Changed; } - -Pass *llvm::createInductiveRangeCheckEliminationPass() { - return new IRCELegacyPass(); -} diff --git a/llvm/lib/Transforms/Scalar/Scalar.cpp b/llvm/lib/Transforms/Scalar/Scalar.cpp --- a/llvm/lib/Transforms/Scalar/Scalar.cpp +++ b/llvm/lib/Transforms/Scalar/Scalar.cpp @@ -38,7 +38,6 @@ initializeEarlyCSEMemSSALegacyPassPass(Registry); initializeMakeGuardsExplicitLegacyPassPass(Registry); initializeFlattenCFGLegacyPassPass(Registry); - initializeIRCELegacyPassPass(Registry); initializeInferAddressSpacesPass(Registry); initializeInstSimplifyLegacyPassPass(Registry); initializeLegacyLICMPassPass(Registry);