diff --git a/llvm/include/llvm/IR/PassManager.h b/llvm/include/llvm/IR/PassManager.h --- a/llvm/include/llvm/IR/PassManager.h +++ b/llvm/include/llvm/IR/PassManager.h @@ -860,16 +860,6 @@ return true; } - /// Invalidate a specific analysis pass for an IR unit. - /// - /// Note that the analysis result can disregard invalidation, if it determines - /// it is in fact still valid. - template void invalidate(IRUnitT &IR) { - assert(AnalysisPasses.count(PassT::ID()) && - "This analysis pass was not registered prior to being invalidated"); - invalidateImpl(PassT::ID(), IR); - } - /// Invalidate cached analyses for an IR unit. /// /// Walk through all of the analyses pertaining to this unit of IR and @@ -904,20 +894,6 @@ return RI == AnalysisResults.end() ? nullptr : &*RI->second->second; } - /// Invalidate a pass result for a IR unit. - void invalidateImpl(AnalysisKey *ID, IRUnitT &IR) { - typename AnalysisResultMapT::iterator RI = - AnalysisResults.find({ID, &IR}); - if (RI == AnalysisResults.end()) - return; - - if (DebugLogging) - dbgs() << "Invalidating analysis: " << this->lookUpPass(ID).name() - << " on " << IR.getName() << "\n"; - AnalysisResultLists[&IR].erase(RI->second); - AnalysisResults.erase(RI); - } - /// Map type from analysis pass ID to pass concept pointer. using AnalysisPassMapT = DenseMap>; 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 @@ -1785,8 +1785,11 @@ } Changed |= CFGChanged; - if (CFGChanged && !SkipProfitabilityChecks) - AM.invalidate(F); + if (CFGChanged && !SkipProfitabilityChecks) { + PreservedAnalyses PA = PreservedAnalyses::all(); + PA.abandon(); + AM.invalidate(F, PA); + } } SmallPriorityWorklist Worklist; @@ -1800,8 +1803,11 @@ Loop *L = Worklist.pop_back_val(); if (IRCE.run(L, LPMAddNewLoop)) { Changed = true; - if (!SkipProfitabilityChecks) - AM.invalidate(F); + if (!SkipProfitabilityChecks) { + PreservedAnalyses PA = PreservedAnalyses::all(); + PA.abandon(); + AM.invalidate(F, PA); + } } }