diff --git a/include/llvm/Analysis/CGSCCPassManager.h b/include/llvm/Analysis/CGSCCPassManager.h index f150064a910..5e83ea2a6e2 100644 --- a/include/llvm/Analysis/CGSCCPassManager.h +++ b/include/llvm/Analysis/CGSCCPassManager.h @@ -364,10 +364,6 @@ public: InvalidSCCSet, nullptr, nullptr, InlinedInternalEdges}; - // Request PassInstrumentation from analysis manager, will use it to run - // instrumenting callbacks for the passes later. - PassInstrumentation PI = AM.getResult(M); - PreservedAnalyses PA = PreservedAnalyses::all(); CG.buildRefSCCs(); for (auto RCI = CG.postorder_ref_scc_begin(), @@ -432,17 +428,8 @@ public: UR.UpdatedRC = nullptr; UR.UpdatedC = nullptr; - - // Check the PassInstrumentation's BeforePass callbacks before - // running the pass, skip its execution completely if asked to - // (callback returns false). - if (!PI.runBeforePass(Pass, *C)) - continue; - PreservedAnalyses PassPA = Pass.run(*C, CGAM, CG, UR); - PI.runAfterPass(Pass, *C); - // Update the SCC and RefSCC if necessary. C = UR.UpdatedC ? UR.UpdatedC : C; RC = UR.UpdatedRC ? UR.UpdatedRC : RC; @@ -628,20 +615,12 @@ public: if (CG.lookupSCC(*N) != CurrentC) continue; - Function &F = N->getFunction(); - - PassInstrumentation PI = FAM.getResult(F); - if (!PI.runBeforePass(Pass, F)) - continue; - - PreservedAnalyses PassPA = Pass.run(F, FAM); - - PI.runAfterPass(Pass, F); + PreservedAnalyses PassPA = Pass.run(N->getFunction(), FAM); // We know that the function pass couldn't have invalidated any other // function's analyses (that's the contract of a function pass), so // directly handle the function analysis manager's invalidation here. - FAM.invalidate(F, PassPA); + FAM.invalidate(N->getFunction(), PassPA); // Then intersect the preserved set so that invalidation of module // analyses will eventually occur when the module pass completes. @@ -711,8 +690,6 @@ public: PreservedAnalyses run(LazyCallGraph::SCC &InitialC, CGSCCAnalysisManager &AM, LazyCallGraph &CG, CGSCCUpdateResult &UR) { PreservedAnalyses PA = PreservedAnalyses::all(); - PassInstrumentation PI = - AM.getResult(InitialC, CG); // The SCC may be refined while we are running passes over it, so set up // a pointer that we can update. @@ -756,14 +733,8 @@ public: auto CallCounts = ScanSCC(*C, CallHandles); for (int Iteration = 0;; ++Iteration) { - - if (!PI.runBeforePass(Pass, *C)) - continue; - PreservedAnalyses PassPA = Pass.run(*C, AM, CG, UR); - PI.runAfterPass(Pass, *C); - // If the SCC structure has changed, bail immediately and let the outer // CGSCC layer handle any iteration to reflect the refined structure. if (UR.UpdatedC && UR.UpdatedC != C) { diff --git a/include/llvm/IR/PassInstrumentation.h b/include/llvm/IR/PassInstrumentation.h deleted file mode 100644 index 3fdda6cb53e..00000000000 --- a/include/llvm/IR/PassInstrumentation.h +++ /dev/null @@ -1,150 +0,0 @@ -//===- llvm/IR/PassInstrumentation.h ----------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -/// \file -/// -/// This file defines the Pass Instrumentation classes that provide -/// instrumentation points into the pass execution by PassManager. -/// -/// There are two main classes: -/// - PassInstrumentation provides a set of instrumentation points for -/// pass managers to call on. -/// -/// - PassInstrumentationCallbacks registers callbacks and provides access -/// to them for PassInstrumentation. -/// -/// PassInstrumentation object is being used as a result of -/// PassInstrumentationAnalysis (so it is intended to be easily copyable). -/// -/// Intended scheme of use for Pass Instrumentation is as follows: -/// - register instrumentation callbacks in PassInstrumentationCallbacks -/// instance. PassBuilder provides helper for that. -/// -/// - register PassInstrumentationAnalysis with all the PassManagers. -/// PassBuilder handles that automatically when registering analyses. -/// -/// - Pass Manager requests PassInstrumentationAnalysis from analysis manager -/// and gets PassInstrumentation as its result. -/// -/// - Pass Manager invokes PassInstrumentation entry points appropriately, -/// passing StringRef identification ("name") of the pass currently being -/// executed and IRUnit it works on. There can be different schemes of -/// providing names in future, currently it is just a name() of the pass. -/// -/// - PassInstrumentation wraps address of IRUnit into llvm::Any and passes -/// control to all the registered callbacks. Note that we specifically wrap -/// 'const IRUnitT*' so as to avoid any accidental changes to IR in -/// instrumenting callbacks. -/// -/// - Some instrumentation points (BeforePass) allow to control execution -/// of a pass. For those callbacks returning false means pass will not be -/// executed. -/// -/// TODO: currently there is no way for a pass to opt-out of execution control -/// (e.g. become unskippable). PassManager is the only entity that determines -/// how pass instrumentation affects pass execution. -/// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_IR_PASSINSTRUMENTATION_H -#define LLVM_IR_PASSINSTRUMENTATION_H - -#include "llvm/ADT/Any.h" -#include "llvm/ADT/FunctionExtras.h" -#include "llvm/ADT/SmallVector.h" -#include "llvm/Support/TypeName.h" -#include - -namespace llvm { - -class PreservedAnalyses; - -/// This class manages callbacks registration, as well as provides a way for -/// PassInstrumentation to pass control to the registered callbacks. -class PassInstrumentationCallbacks { -public: - // Before/After Pass callbacks accept IRUnits, so they need to take them - // as pointers, wrapped with llvm::Any - using BeforePassFunc = bool(StringRef, Any); - using AfterPassFunc = void(StringRef, Any); - using BeforeAnalysisFunc = void(StringRef, Any); - using AfterAnalysisFunc = void(StringRef, Any); - -public: - PassInstrumentationCallbacks() {} - - /// Copying PassInstrumentationCallbacks is not intended. - PassInstrumentationCallbacks(const PassInstrumentationCallbacks &) = delete; - void operator=(const PassInstrumentationCallbacks &) = delete; - - template void registerBeforePassCallback(CallableT C) { - BeforePassCallbacks.emplace_back(std::move(C)); - } - - template void registerAfterPassCallback(CallableT C) { - AfterPassCallbacks.emplace_back(std::move(C)); - } - -private: - friend class PassInstrumentation; - - SmallVector, 4> BeforePassCallbacks; - SmallVector, 4> AfterPassCallbacks; -}; - -/// This class provides instrumentation entry points for the Pass Manager, -/// doing calls to callbacks registered in PassInstrumentationCallbacks. -class PassInstrumentation { - PassInstrumentationCallbacks *Callbacks; - -public: - /// Callbacks object is not owned by PassInstrumentation, its life-time - /// should at least match the life-time of corresponding - /// PassInstrumentationAnalysis (which usually is till the end of current - /// compilation). - PassInstrumentation(PassInstrumentationCallbacks *CB = nullptr) - : Callbacks(CB) {} - - /// BeforePass instrumentation point - takes \p Pass instance to be executed - /// and constant reference to IR it operates on. \Returns true if pass is - /// allowed to be executed. - template - bool runBeforePass(const PassT &Pass, const IRUnitT &IR) const { - if (!Callbacks) - return true; - - bool ShouldRun = true; - for (auto &C : Callbacks->BeforePassCallbacks) - ShouldRun &= C(Pass.name(), llvm::Any(&IR)); - return ShouldRun; - } - - /// AfterPass instrumentation point - takes \p Pass instance that has - /// just been executed and constant reference to IR it operates on. - template - void runAfterPass(const PassT &Pass, const IRUnitT &IR) const { - if (Callbacks) - for (auto &C : Callbacks->AfterPassCallbacks) - C(Pass.name(), llvm::Any(&IR)); - } - - /// Handle invalidation from the pass manager when PassInstrumentation - /// is used as the result of PassInstrumentationAnalysis. - /// - /// On attempt to invalidate just return false. There is nothing to become - /// invalid here. - template - bool invalidate(IRUnitT &, const class llvm::PreservedAnalyses &, - ExtraArgsT...) { - return false; - } -}; - -} // namespace llvm - -#endif diff --git a/include/llvm/IR/PassManager.h b/include/llvm/IR/PassManager.h index f3182376c10..3c18bbd5df7 100644 --- a/include/llvm/IR/PassManager.h +++ b/include/llvm/IR/PassManager.h @@ -44,7 +44,6 @@ #include "llvm/ADT/TinyPtrVector.h" #include "llvm/IR/Function.h" #include "llvm/IR/Module.h" -#include "llvm/IR/PassInstrumentation.h" #include "llvm/IR/PassManagerInternal.h" #include "llvm/Support/Debug.h" #include "llvm/Support/TypeName.h" @@ -403,43 +402,6 @@ struct AnalysisInfoMixin : PassInfoMixin { } }; -namespace detail { - -/// Actual unpacker of extra arguments in getAnalysisResult, -/// passes only those tuple arguments that are mentioned in index_sequence. -template -typename PassT::Result -getAnalysisResultUnpackTuple(AnalysisManagerT &AM, IRUnitT &IR, - std::tuple Args, - llvm::index_sequence) { - (void)Args; - return AM.template getResult(IR, std::get(Args)...); -} - -/// Helper for *partial* unpacking of extra arguments in getAnalysisResult. -/// -/// Arguments passed in tuple come from PassManager, so they might have extra -/// arguments after those AnalysisManager's ExtraArgTs ones that we need to -/// pass to getResult. -template -typename PassT::Result -getAnalysisResult(AnalysisManager &AM, IRUnitT &IR, - std::tuple Args) { - return (getAnalysisResultUnpackTuple< - PassT, IRUnitT>)(AM, IR, Args, - llvm::index_sequence_for{}); -} - -} // namespace detail - -// Forward declare the pass instrumentation analysis explicitly queried in -// generic PassManager code. -// FIXME: figure out a way to move PassInstrumentationAnalysis into its own -// header. -class PassInstrumentationAnalysis; - /// Manages a sequence of passes over a particular unit of IR. /// /// A pass manager contains a sequence of passes to run over a particular unit @@ -483,34 +445,15 @@ public: ExtraArgTs... ExtraArgs) { PreservedAnalyses PA = PreservedAnalyses::all(); - // Request PassInstrumentation from analysis manager, will use it to run - // instrumenting callbacks for the passes later. - // Here we use std::tuple wrapper over getResult which helps to extract - // AnalysisManager's arguments out of the whole ExtraArgs set. - PassInstrumentation PI = - detail::getAnalysisResult( - AM, IR, std::tuple(ExtraArgs...)); - if (DebugLogging) dbgs() << "Starting " << getTypeName() << " pass manager run.\n"; for (unsigned Idx = 0, Size = Passes.size(); Idx != Size; ++Idx) { - auto *P = Passes[Idx].get(); if (DebugLogging) - dbgs() << "Running pass: " << P->name() << " on " << IR.getName() - << "\n"; + dbgs() << "Running pass: " << Passes[Idx]->name() << " on " + << IR.getName() << "\n"; - // Check the PassInstrumentation's BeforePass callbacks before running the - // pass, skip its execution completely if asked to (callback returns - // false). - if (!PI.runBeforePass(*P, IR)) - continue; - - PreservedAnalyses PassPA = P->run(IR, AM, ExtraArgs...); - - // Call onto PassInstrumentation's AfterPass callbacks immediately after - // running the pass. - PI.runAfterPass(*P, IR); + PreservedAnalyses PassPA = Passes[Idx]->run(IR, AM, ExtraArgs...); // Update the analysis manager as each pass runs and potentially // invalidates analyses. @@ -567,32 +510,6 @@ extern template class PassManager; /// Convenience typedef for a pass manager over functions. using FunctionPassManager = PassManager; -/// Pseudo-analysis pass that exposes the \c PassInstrumentation to pass -/// managers. Goes before AnalysisManager definition to provide its -/// internals (e.g PassInstrumentationAnalysis::ID) for use there if needed. -/// FIXME: figure out a way to move PassInstrumentationAnalysis into its own -/// header. -class PassInstrumentationAnalysis - : public AnalysisInfoMixin { - friend AnalysisInfoMixin; - static AnalysisKey Key; - - PassInstrumentationCallbacks *Callbacks; - -public: - /// PassInstrumentationCallbacks object is shared, owned by something else, - /// not this analysis. - PassInstrumentationAnalysis(PassInstrumentationCallbacks *Callbacks = nullptr) - : Callbacks(Callbacks) {} - - using Result = PassInstrumentation; - - template - Result run(IRUnitT &, AnalysisManagerT &, ExtraArgTs &&...) { - return PassInstrumentation(Callbacks); - } -}; - /// A container for analyses that lazily runs them and caches their /// results. /// @@ -1275,24 +1192,13 @@ public: FunctionAnalysisManager &FAM = AM.getResult(M).getManager(); - // Request PassInstrumentation from analysis manager, will use it to run - // instrumenting callbacks for the passes later. - PassInstrumentation PI = AM.getResult(M); - PreservedAnalyses PA = PreservedAnalyses::all(); for (Function &F : M) { if (F.isDeclaration()) continue; - // Check the PassInstrumentation's BeforePass callbacks before running the - // pass, skip its execution completely if asked to (callback returns - // false). - if (!PI.runBeforePass(Pass, F)) - continue; PreservedAnalyses PassPA = Pass.run(F, FAM); - PI.runAfterPass(Pass, F); - // We know that the function pass couldn't have invalidated any other // function's analyses (that's the contract of a function pass), so // directly handle the function analysis manager's invalidation here. @@ -1396,26 +1302,10 @@ public: RepeatedPass(int Count, PassT P) : Count(Count), P(std::move(P)) {} template - PreservedAnalyses run(IRUnitT &IR, AnalysisManagerT &AM, Ts &&... Args) { - - // Request PassInstrumentation from analysis manager, will use it to run - // instrumenting callbacks for the passes later. - // Here we use std::tuple wrapper over getResult which helps to extract - // AnalysisManager's arguments out of the whole Args set. - PassInstrumentation PI = - detail::getAnalysisResult( - AM, IR, std::tuple(Args...)); - + PreservedAnalyses run(IRUnitT &Arg, AnalysisManagerT &AM, Ts &&... Args) { auto PA = PreservedAnalyses::all(); - for (int i = 0; i < Count; ++i) { - // Check the PassInstrumentation's BeforePass callbacks before running the - // pass, skip its execution completely if asked to (callback returns - // false). - if (!PI.runBeforePass(P, IR)) - continue; - PA.intersect(P.run(IR, AM, std::forward(Args)...)); - PI.runAfterPass(P, IR); - } + for (int i = 0; i < Count; ++i) + PA.intersect(P.run(Arg, AM, std::forward(Args)...)); return PA; } diff --git a/include/llvm/Passes/PassBuilder.h b/include/llvm/Passes/PassBuilder.h index 02d3dc324bc..24a93bc76af 100644 --- a/include/llvm/Passes/PassBuilder.h +++ b/include/llvm/Passes/PassBuilder.h @@ -58,7 +58,6 @@ struct PGOOptions { class PassBuilder { TargetMachine *TM; Optional PGOOpt; - PassInstrumentationCallbacks *PIC; public: /// A struct to capture parsed pass pipeline names. @@ -173,9 +172,8 @@ public: }; explicit PassBuilder(TargetMachine *TM = nullptr, - Optional PGOOpt = None, - PassInstrumentationCallbacks *PIC = nullptr) - : TM(TM), PGOOpt(PGOOpt), PIC(PIC) {} + Optional PGOOpt = None) + : TM(TM), PGOOpt(PGOOpt) {} /// Cross register the analysis managers through their proxies. /// diff --git a/include/llvm/Transforms/Scalar/LoopPassManager.h b/include/llvm/Transforms/Scalar/LoopPassManager.h index e54960d199c..0d691f3fee4 100644 --- a/include/llvm/Transforms/Scalar/LoopPassManager.h +++ b/include/llvm/Transforms/Scalar/LoopPassManager.h @@ -276,15 +276,7 @@ public: // pass pipeline to put loops into their canonical form. Note that we can // directly build up function analyses after this as the function pass // manager handles all the invalidation at that layer. - PassInstrumentation PI = AM.getResult(F); - - PreservedAnalyses PA = PreservedAnalyses::all(); - // Check the PassInstrumentation's BeforePass callbacks before running the - // canonicalization pipeline. - if (PI.runBeforePass(LoopCanonicalizationFPM, F)) { - PA = LoopCanonicalizationFPM.run(F, AM); - PI.runAfterPass(LoopCanonicalizationFPM, F); - } + PreservedAnalyses PA = LoopCanonicalizationFPM.run(F, AM); // Get the loop structure for this function LoopInfo &LI = AM.getResult(F); @@ -345,15 +337,8 @@ public: assert(L->isRecursivelyLCSSAForm(LAR.DT, LI) && "Loops must remain in LCSSA form!"); #endif - // Check the PassInstrumentation's BeforePass callbacks before running the - // pass, skip its execution completely if asked to (callback returns - // false). - if (!PI.runBeforePass(Pass, *L)) - continue; + PreservedAnalyses PassPA = Pass.run(*L, LAM, LAR, Updater); - - PI.runAfterPass(Pass, *L); - // FIXME: We should verify the set of analyses relevant to Loop passes // are preserved. diff --git a/lib/Analysis/CGSCCPassManager.cpp b/lib/Analysis/CGSCCPassManager.cpp index 6965235326d..b325afb8e7c 100644 --- a/lib/Analysis/CGSCCPassManager.cpp +++ b/lib/Analysis/CGSCCPassManager.cpp @@ -54,11 +54,6 @@ PassManager::run(LazyCallGraph::SCC &InitialC, CGSCCAnalysisManager &AM, LazyCallGraph &G, CGSCCUpdateResult &UR) { - // Request PassInstrumentation from analysis manager, will use it to run - // instrumenting callbacks for the passes later. - PassInstrumentation PI = - AM.getResult(InitialC, G); - PreservedAnalyses PA = PreservedAnalyses::all(); if (DebugLogging) @@ -72,15 +67,8 @@ PassManagername() << " on " << *C << "\n"; - // Check the PassInstrumentation's BeforePass callbacks before running the - // pass, skip its execution completely if asked to (callback returns false). - if (!PI.runBeforePass(*Pass, *C)) - continue; - PreservedAnalyses PassPA = Pass->run(*C, AM, G, UR); - PI.runAfterPass(*Pass, *C); - // Update the SCC if necessary. C = UR.UpdatedC ? UR.UpdatedC : C; diff --git a/lib/FuzzMutate/IRMutator.cpp b/lib/FuzzMutate/IRMutator.cpp index 40e402cdade..2dc7dfb880a 100644 --- a/lib/FuzzMutate/IRMutator.cpp +++ b/lib/FuzzMutate/IRMutator.cpp @@ -73,7 +73,6 @@ static void eliminateDeadCode(Function &F) { FPM.addPass(DCEPass()); FunctionAnalysisManager FAM; FAM.registerPass([&] { return TargetLibraryAnalysis(); }); - FAM.registerPass([&] { return PassInstrumentationAnalysis(); }); FPM.run(F, FAM); } diff --git a/lib/IR/CMakeLists.txt b/lib/IR/CMakeLists.txt index 2586f987289..a194b840e0e 100644 --- a/lib/IR/CMakeLists.txt +++ b/lib/IR/CMakeLists.txt @@ -42,7 +42,6 @@ add_llvm_library(LLVMCore Operator.cpp OptBisect.cpp Pass.cpp - PassInstrumentation.cpp PassManager.cpp PassRegistry.cpp PassTimingInfo.cpp diff --git a/lib/IR/PassInstrumentation.cpp b/lib/IR/PassInstrumentation.cpp deleted file mode 100644 index 5aa2bc6d895..00000000000 --- a/lib/IR/PassInstrumentation.cpp +++ /dev/null @@ -1,22 +0,0 @@ -//===- PassInstrumentation.cpp - Pass Instrumentation interface -*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -/// \file -/// -/// This file provides the implementation of PassInstrumentation class. -/// -//===----------------------------------------------------------------------===// - -#include "llvm/IR/PassInstrumentation.h" -#include "llvm/IR/PassManager.h" - -namespace llvm { - -AnalysisKey PassInstrumentationAnalysis::Key; - -} // namespace llvm diff --git a/lib/Passes/PassRegistry.def b/lib/Passes/PassRegistry.def index b070b0ed303..5748c0d9f8a 100644 --- a/lib/Passes/PassRegistry.def +++ b/lib/Passes/PassRegistry.def @@ -26,7 +26,6 @@ MODULE_ANALYSIS("no-op-module", NoOpModuleAnalysis()) MODULE_ANALYSIS("profile-summary", ProfileSummaryAnalysis()) MODULE_ANALYSIS("targetlibinfo", TargetLibraryAnalysis()) MODULE_ANALYSIS("verify", VerifierAnalysis()) -MODULE_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis(PIC)) #ifndef MODULE_ALIAS_ANALYSIS #define MODULE_ALIAS_ANALYSIS(NAME, CREATE_PASS) \ @@ -85,7 +84,6 @@ MODULE_PASS("verify", VerifierPass()) #endif CGSCC_ANALYSIS("no-op-cgscc", NoOpCGSCCAnalysis()) CGSCC_ANALYSIS("fam-proxy", FunctionAnalysisManagerCGSCCProxy()) -CGSCC_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis(PIC)) #undef CGSCC_ANALYSIS #ifndef CGSCC_PASS @@ -123,7 +121,6 @@ FUNCTION_ANALYSIS("targetlibinfo", TargetLibraryAnalysis()) FUNCTION_ANALYSIS("targetir", TM ? TM->getTargetIRAnalysis() : TargetIRAnalysis()) FUNCTION_ANALYSIS("verify", VerifierAnalysis()) -FUNCTION_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis(PIC)) #ifndef FUNCTION_ALIAS_ANALYSIS #define FUNCTION_ALIAS_ANALYSIS(NAME, CREATE_PASS) \ @@ -229,7 +226,6 @@ FUNCTION_PASS("view-cfg-only", CFGOnlyViewerPass()) LOOP_ANALYSIS("no-op-loop", NoOpLoopAnalysis()) LOOP_ANALYSIS("access-info", LoopAccessAnalysis()) LOOP_ANALYSIS("ivusers", IVUsersAnalysis()) -LOOP_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis(PIC)) #undef LOOP_ANALYSIS #ifndef LOOP_PASS diff --git a/lib/Transforms/Scalar/LoopPassManager.cpp b/lib/Transforms/Scalar/LoopPassManager.cpp index 6759bd2537c..10f6fcdcfdb 100644 --- a/lib/Transforms/Scalar/LoopPassManager.cpp +++ b/lib/Transforms/Scalar/LoopPassManager.cpp @@ -30,22 +30,12 @@ PassManager(L, AR); for (auto &Pass : Passes) { if (DebugLogging) dbgs() << "Running pass: " << Pass->name() << " on " << L; - // Check the PassInstrumentation's BeforePass callbacks before running the - // pass, skip its execution completely if asked to (callback returns false). - if (!PI.runBeforePass(*Pass, L)) - continue; - PreservedAnalyses PassPA = Pass->run(L, AM, AR, U); - PI.runAfterPass(*Pass, L); - // If the loop was deleted, abort the run and return to the outer walk. if (U.skipCurrentLoop()) { PA.intersect(std::move(PassPA)); diff --git a/test/Other/loop-pm-invalidation.ll b/test/Other/loop-pm-invalidation.ll index 20acb357353..a6f5302462d 100644 --- a/test/Other/loop-pm-invalidation.ll +++ b/test/Other/loop-pm-invalidation.ll @@ -73,7 +73,6 @@ define void @one_loop(i1* %ptr) { ; CHECK-LOOP-INV-NEXT: Running analysis: TargetIRAnalysis ; CHECK-LOOP-INV-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Loop ; CHECK-LOOP-INV-NEXT: Starting {{.*}}Loop pass manager run. -; CHECK-LOOP-INV-NEXT: Running analysis: PassInstrumentationAnalysis ; CHECK-LOOP-INV-NEXT: Running pass: NoOpLoopPass ; CHECK-LOOP-INV-NEXT: Finished {{.*}}Loop pass manager run. ; CHECK-LOOP-INV-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}LoopAnalysis @@ -91,7 +90,6 @@ define void @one_loop(i1* %ptr) { ; CHECK-LOOP-INV-NEXT: Running analysis: ScalarEvolutionAnalysis ; CHECK-LOOP-INV-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Loop ; CHECK-LOOP-INV-NEXT: Starting {{.*}}Loop pass manager run. -; CHECK-LOOP-INV-NEXT: Running analysis: PassInstrumentationAnalysis ; CHECK-LOOP-INV-NEXT: Running pass: NoOpLoopPass ; CHECK-LOOP-INV-NEXT: Finished {{.*}}Loop pass manager run. ; CHECK-LOOP-INV-NEXT: Finished {{.*}}Function pass manager run. @@ -110,7 +108,6 @@ define void @one_loop(i1* %ptr) { ; CHECK-SCEV-INV-NEXT: Running analysis: TargetIRAnalysis ; CHECK-SCEV-INV-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Loop ; CHECK-SCEV-INV-NEXT: Starting {{.*}}Loop pass manager run. -; CHECK-SCEV-INV-NEXT: Running analysis: PassInstrumentationAnalysis ; CHECK-SCEV-INV-NEXT: Running pass: NoOpLoopPass ; CHECK-SCEV-INV-NEXT: Finished {{.*}}Loop pass manager run. ; CHECK-SCEV-INV-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}ScalarEvolutionAnalysis @@ -126,7 +123,6 @@ define void @one_loop(i1* %ptr) { ; CHECK-SCEV-INV-NEXT: Running analysis: ScalarEvolutionAnalysis ; CHECK-SCEV-INV-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Loop ; CHECK-SCEV-INV-NEXT: Starting {{.*}}Loop pass manager run. -; CHECK-SCEV-INV-NEXT: Running analysis: PassInstrumentationAnalysis ; CHECK-SCEV-INV-NEXT: Running pass: NoOpLoopPass ; CHECK-SCEV-INV-NEXT: Finished {{.*}}Loop pass manager run. ; CHECK-SCEV-INV-NEXT: Finished {{.*}}Function pass manager run. @@ -157,11 +153,9 @@ define void @nested_loops(i1* %ptr) { ; CHECK-LOOP-INV-NEXT: Running analysis: TargetIRAnalysis ; CHECK-LOOP-INV-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Loop ; CHECK-LOOP-INV-NEXT: Starting {{.*}}Loop pass manager run. -; CHECK-LOOP-INV-NEXT: Running analysis: PassInstrumentationAnalysis ; CHECK-LOOP-INV-NEXT: Running pass: NoOpLoopPass ; CHECK-LOOP-INV-NEXT: Finished {{.*}}Loop pass manager run. ; CHECK-LOOP-INV-NEXT: Starting {{.*}}Loop pass manager run. -; CHECK-LOOP-INV-NEXT: Running analysis: PassInstrumentationAnalysis ; CHECK-LOOP-INV-NEXT: Running pass: NoOpLoopPass ; CHECK-LOOP-INV: Finished {{.*}}Loop pass manager run. ; CHECK-LOOP-INV-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}LoopAnalysis @@ -180,11 +174,9 @@ define void @nested_loops(i1* %ptr) { ; CHECK-LOOP-INV-NEXT: Running analysis: ScalarEvolutionAnalysis ; CHECK-LOOP-INV-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Loop ; CHECK-LOOP-INV-NEXT: Starting {{.*}}Loop pass manager run. -; CHECK-LOOP-INV-NEXT: Running analysis: PassInstrumentationAnalysis ; CHECK-LOOP-INV-NEXT: Running pass: NoOpLoopPass ; CHECK-LOOP-INV-NEXT: Finished {{.*}}Loop pass manager run. ; CHECK-LOOP-INV-NEXT: Starting {{.*}}Loop pass manager run. -; CHECK-LOOP-INV-NEXT: Running analysis: PassInstrumentationAnalysis ; CHECK-LOOP-INV-NEXT: Running pass: NoOpLoopPass ; CHECK-LOOP-INV: Finished {{.*}}Loop pass manager run. ; CHECK-LOOP-INV-NEXT: Finished {{.*}}Function pass manager run. @@ -203,11 +195,9 @@ define void @nested_loops(i1* %ptr) { ; CHECK-SCEV-INV-NEXT: Running analysis: TargetIRAnalysis ; CHECK-SCEV-INV-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Loop ; CHECK-SCEV-INV-NEXT: Starting {{.*}}Loop pass manager run. -; CHECK-SCEV-INV-NEXT: Running analysis: PassInstrumentationAnalysis ; CHECK-SCEV-INV-NEXT: Running pass: NoOpLoopPass ; CHECK-SCEV-INV-NEXT: Finished {{.*}}Loop pass manager run. ; CHECK-SCEV-INV-NEXT: Starting {{.*}}Loop pass manager run. -; CHECK-SCEV-INV-NEXT: Running analysis: PassInstrumentationAnalysis ; CHECK-SCEV-INV-NEXT: Running pass: NoOpLoopPass ; CHECK-SCEV-INV: Finished {{.*}}Loop pass manager run. ; CHECK-SCEV-INV-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}ScalarEvolutionAnalysis @@ -224,11 +214,9 @@ define void @nested_loops(i1* %ptr) { ; CHECK-SCEV-INV-NEXT: Running analysis: ScalarEvolutionAnalysis ; CHECK-SCEV-INV-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Loop ; CHECK-SCEV-INV-NEXT: Starting {{.*}}Loop pass manager run. -; CHECK-SCEV-INV-NEXT: Running analysis: PassInstrumentationAnalysis ; CHECK-SCEV-INV-NEXT: Running pass: NoOpLoopPass ; CHECK-SCEV-INV-NEXT: Finished {{.*}}Loop pass manager run. ; CHECK-SCEV-INV-NEXT: Starting {{.*}}Loop pass manager run. -; CHECK-SCEV-INV-NEXT: Running analysis: PassInstrumentationAnalysis ; CHECK-SCEV-INV-NEXT: Running pass: NoOpLoopPass ; CHECK-SCEV-INV: Finished {{.*}}Loop pass manager run. ; CHECK-SCEV-INV-NEXT: Finished {{.*}}Function pass manager run. @@ -266,7 +254,6 @@ define void @dead_loop() { ; CHECK-LOOP-INV-NEXT: Running analysis: TargetIRAnalysis ; CHECK-LOOP-INV-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Loop ; CHECK-LOOP-INV-NEXT: Starting {{.*}}Loop pass manager run. -; CHECK-LOOP-INV-NEXT: Running analysis: PassInstrumentationAnalysis ; CHECK-LOOP-INV-NEXT: Running pass: NoOpLoopPass ; CHECK-LOOP-INV-NEXT: Finished {{.*}}Loop pass manager run. ; CHECK-LOOP-INV-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}LoopAnalysis @@ -284,7 +271,6 @@ define void @dead_loop() { ; CHECK-LOOP-INV-NEXT: Running analysis: ScalarEvolutionAnalysis ; CHECK-LOOP-INV-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Loop ; CHECK-LOOP-INV-NEXT: Starting {{.*}}Loop pass manager run. -; CHECK-LOOP-INV-NEXT: Running analysis: PassInstrumentationAnalysis ; CHECK-LOOP-INV-NEXT: Running pass: NoOpLoopPass ; CHECK-LOOP-INV-NEXT: Finished {{.*}}Loop pass manager run. ; CHECK-LOOP-INV-NEXT: Finished {{.*}}Function pass manager run. @@ -303,7 +289,6 @@ define void @dead_loop() { ; CHECK-SCEV-INV-NEXT: Running analysis: TargetIRAnalysis ; CHECK-SCEV-INV-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Loop ; CHECK-SCEV-INV-NEXT: Starting {{.*}}Loop pass manager run. -; CHECK-SCEV-INV-NEXT: Running analysis: PassInstrumentationAnalysis ; CHECK-SCEV-INV-NEXT: Running pass: NoOpLoopPass ; CHECK-SCEV-INV-NEXT: Finished {{.*}}Loop pass manager run. ; CHECK-SCEV-INV-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}ScalarEvolutionAnalysis @@ -319,7 +304,6 @@ define void @dead_loop() { ; CHECK-SCEV-INV-NEXT: Running analysis: ScalarEvolutionAnalysis ; CHECK-SCEV-INV-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Loop ; CHECK-SCEV-INV-NEXT: Starting {{.*}}Loop pass manager run. -; CHECK-SCEV-INV-NEXT: Running analysis: PassInstrumentationAnalysis ; CHECK-SCEV-INV-NEXT: Running pass: NoOpLoopPass ; CHECK-SCEV-INV-NEXT: Finished {{.*}}Loop pass manager run. ; CHECK-SCEV-INV-NEXT: Finished {{.*}}Function pass manager run. @@ -338,7 +322,6 @@ define void @dead_loop() { ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Running analysis: TargetIRAnalysis ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Loop ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Starting {{.*}}Loop pass manager run. -; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Running analysis: PassInstrumentationAnalysis ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Running pass: NoOpLoopPass ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Running pass: LoopDeletionPass ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Clearing all analysis results for: diff --git a/test/Other/new-pass-manager.ll b/test/Other/new-pass-manager.ll index 5f5ba19a62a..320fd04ed9d 100644 --- a/test/Other/new-pass-manager.ll +++ b/test/Other/new-pass-manager.ll @@ -24,7 +24,6 @@ ; CHECK-CGSCC-PASS-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*(FunctionAnalysisManager|AnalysisManager<.*Function.*>).*}},{{.*}}Module> ; CHECK-CGSCC-PASS-NEXT: Running analysis: LazyCallGraphAnalysis ; CHECK-CGSCC-PASS-NEXT: Running analysis: TargetLibraryAnalysis -; CHECK-CGSCC-PASS-NEXT: Running analysis: PassInstrumentationAnalysis ; CHECK-CGSCC-PASS-NEXT: Starting CGSCC pass manager run ; CHECK-CGSCC-PASS-NEXT: Running pass: NoOpCGSCCPass ; CHECK-CGSCC-PASS-NEXT: Finished CGSCC pass manager run @@ -39,7 +38,6 @@ ; CHECK-FUNCTION-PASS: Starting llvm::Module pass manager run ; CHECK-FUNCTION-PASS-NEXT: Running pass: ModuleToFunctionPassAdaptor ; CHECK-FUNCTION-PASS-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}> -; CHECK-FUNCTION-PASS-NEXT: Running analysis: PassInstrumentationAnalysis ; CHECK-FUNCTION-PASS-NEXT: Starting llvm::Function pass manager run ; CHECK-FUNCTION-PASS-NEXT: Running pass: NoOpFunctionPass ; CHECK-FUNCTION-PASS-NEXT: Finished llvm::Function pass manager run @@ -410,7 +408,6 @@ ; CHECK-REPEAT-CGSCC-PASS-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*(FunctionAnalysisManager|AnalysisManager<.*Function.*>).*}},{{.*}}Module> ; CHECK-REPEAT-CGSCC-PASS-NEXT: Running analysis: LazyCallGraphAnalysis ; CHECK-REPEAT-CGSCC-PASS-NEXT: Running analysis: TargetLibraryAnalysis -; CHECK-REPEAT-CGSCC-PASS-NEXT: Running analysis: PassInstrumentationAnalysis ; CHECK-REPEAT-CGSCC-PASS-NEXT: Starting CGSCC pass manager run ; CHECK-REPEAT-CGSCC-PASS-NEXT: Running pass: RepeatedPass ; CHECK-REPEAT-CGSCC-PASS-NEXT: Starting CGSCC pass manager run @@ -431,7 +428,6 @@ ; CHECK-REPEAT-FUNCTION-PASS: Starting llvm::Module pass manager run ; CHECK-REPEAT-FUNCTION-PASS-NEXT: Running pass: ModuleToFunctionPassAdaptor ; CHECK-REPEAT-FUNCTION-PASS-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}> -; CHECK-REPEAT-FUNCTION-PASS-NEXT: Running analysis: PassInstrumentationAnalysis ; CHECK-REPEAT-FUNCTION-PASS-NEXT: Starting llvm::Function pass manager run ; CHECK-REPEAT-FUNCTION-PASS-NEXT: Running pass: RepeatedPass ; CHECK-REPEAT-FUNCTION-PASS-NEXT: Starting llvm::Function pass manager run @@ -452,7 +448,6 @@ ; CHECK-REPEAT-LOOP-PASS: Starting llvm::Module pass manager run ; CHECK-REPEAT-LOOP-PASS-NEXT: Running pass: ModuleToFunctionPassAdaptor ; CHECK-REPEAT-LOOP-PASS-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}> -; CHECK-REPEAT-LOOP-PASS-NEXT: Running analysis: PassInstrumentationAnalysis ; CHECK-REPEAT-LOOP-PASS-NEXT: Starting llvm::Function pass manager run ; CHECK-REPEAT-LOOP-PASS-NEXT: Running pass: FunctionToLoopPassAdaptor ; CHECK-REPEAT-LOOP-PASS-NEXT: Starting llvm::Function pass manager run @@ -469,7 +464,6 @@ ; CHECK-REPEAT-LOOP-PASS-NEXT: Running analysis: TargetIRAnalysis ; CHECK-REPEAT-LOOP-PASS-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}> ; CHECK-REPEAT-LOOP-PASS-NEXT: Starting Loop pass manager run -; CHECK-REPEAT-LOOP-PASS-NEXT: Running analysis: PassInstrumentationAnalysis ; CHECK-REPEAT-LOOP-PASS-NEXT: Running pass: RepeatedPass ; CHECK-REPEAT-LOOP-PASS-NEXT: Starting Loop pass manager run ; CHECK-REPEAT-LOOP-PASS-NEXT: Running pass: NoOpLoopPass diff --git a/test/Other/new-pm-defaults.ll b/test/Other/new-pm-defaults.ll index 114514a13fc..10580e4925c 100644 --- a/test/Other/new-pm-defaults.ll +++ b/test/Other/new-pm-defaults.ll @@ -67,8 +67,7 @@ ; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O3 \ ; RUN: --check-prefix=CHECK-EP-PIPELINE-START -; CHECK-O: Running analysis: PassInstrumentationAnalysis -; CHECK-O-NEXT: Starting llvm::Module pass manager run. +; CHECK-O: Starting llvm::Module pass manager run. ; CHECK-O-NEXT: Running pass: PassManager<{{.*}}Module{{.*}}> ; CHECK-O-NEXT: Starting llvm::Module pass manager run. ; CHECK-O-NEXT: Running pass: ForceFunctionAttrsPass @@ -79,7 +78,6 @@ ; CHECK-O-NEXT: Running analysis: TargetLibraryAnalysis ; CHECK-O-NEXT: Running pass: ModuleToFunctionPassAdaptor<{{.*}}PassManager{{.*}}> ; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy -; CHECK-O-NEXT: Running analysis: PassInstrumentationAnalysis ; CHECK-O-NEXT: Starting llvm::Function pass manager run. ; CHECK-O-NEXT: Running pass: SimplifyCFGPass ; CHECK-O-NEXT: Running analysis: TargetIRAnalysis @@ -112,7 +110,6 @@ ; CHECK-O-NEXT: Running pass: ModuleToPostOrderCGSCCPassAdaptor<{{.*}}LazyCallGraph{{.*}}> ; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy ; CHECK-O-NEXT: Running analysis: LazyCallGraphAnalysis -; CHECK-O-NEXT: Running analysis: PassInstrumentationAnalysis ; CHECK-O-NEXT: Starting CGSCC pass manager run. ; CHECK-O-NEXT: Running pass: InlinerPass ; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy<{{.*}}LazyCallGraph{{.*}}> @@ -152,7 +149,6 @@ ; CHECK-O-NEXT: Running analysis: ScalarEvolutionAnalysis ; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy ; CHECK-O-NEXT: Starting Loop pass manager run. -; CHECK-O-NEXT: Running analysis: PassInstrumentationAnalysis ; CHECK-O-NEXT: Running pass: LoopInstSimplifyPass ; CHECK-O-NEXT: Running pass: LoopSimplifyCFGPass ; CHECK-O-NEXT: Running pass: LoopRotatePass diff --git a/test/Other/new-pm-lto-defaults.ll b/test/Other/new-pm-lto-defaults.ll index 92b41536612..741ed641f53 100644 --- a/test/Other/new-pm-lto-defaults.ll +++ b/test/Other/new-pm-lto-defaults.ll @@ -23,8 +23,7 @@ ; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O2 \ ; RUN: --check-prefix=CHECK-O3 --check-prefix=CHECK-EP-Peephole -; CHECK-O: Running analysis: PassInstrumentationAnalysis -; CHECK-O-NEXT: Starting llvm::Module pass manager run. +; CHECK-O: Starting llvm::Module pass manager run. ; CHECK-O-NEXT: Running pass: PassManager<{{.*}}Module ; CHECK-O-NEXT: Starting llvm::Module pass manager run. ; CHECK-O-NEXT: Running pass: GlobalDCEPass @@ -33,7 +32,6 @@ ; CHECK-O-NEXT: Running analysis: TargetLibraryAnalysis ; CHECK-O2-NEXT: Running pass: ModuleToFunctionPassAdaptor<{{.*}}PassManager{{.*}}> ; CHECK-O2-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Module -; CHECK-O2-NEXT: Running analysis: PassInstrumentationAnalysis ; CHECK-O2-NEXT: Starting llvm::Function pass manager run. ; CHECK-O2-NEXT: Running pass: CallSiteSplittingPass on foo ; CHECK-O2-NEXT: Running analysis: TargetLibraryAnalysis on foo diff --git a/test/Other/new-pm-thinlto-defaults.ll b/test/Other/new-pm-thinlto-defaults.ll index ece33c81863..dae51eb969a 100644 --- a/test/Other/new-pm-thinlto-defaults.ll +++ b/test/Other/new-pm-thinlto-defaults.ll @@ -47,8 +47,7 @@ ; RUN: -passes='thinlto' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O2,CHECK-POSTLINK-O,CHECK-POSTLINK-O2 ; -; CHECK-O: Running analysis: PassInstrumentationAnalysis -; CHECK-O-NEXT: Starting llvm::Module pass manager run. +; CHECK-O: Starting llvm::Module pass manager run. ; CHECK-O-NEXT: Running pass: PassManager<{{.*}}Module{{.*}}> ; CHECK-O-NEXT: Starting llvm::Module pass manager run. ; CHECK-O-NEXT: Running pass: ForceFunctionAttrsPass @@ -65,7 +64,6 @@ ; CHECK-O-NEXT: Running analysis: TargetLibraryAnalysis ; CHECK-O-NEXT: Running pass: ModuleToFunctionPassAdaptor<{{.*}}PassManager{{.*}}> ; CHECK-PRELINK-O-NODIS-NEXT: Running analysis: InnerAnalysisManagerProxy -; CHECK-O-NEXT: Running analysis: PassInstrumentationAnalysis ; CHECK-O-NEXT: Starting llvm::Function pass manager run. ; CHECK-O-NEXT: Running pass: SimplifyCFGPass ; CHECK-O-NEXT: Running analysis: TargetIRAnalysis @@ -97,7 +95,6 @@ ; CHECK-O-NEXT: Running pass: ModuleToPostOrderCGSCCPassAdaptor<{{.*}}LazyCallGraph{{.*}}> ; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy ; CHECK-O-NEXT: Running analysis: LazyCallGraphAnalysis -; CHECK-O-NEXT: Running analysis: PassInstrumentationAnalysis ; CHECK-O-NEXT: Starting CGSCC pass manager run. ; CHECK-O-NEXT: Running pass: InlinerPass ; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy<{{.*}}LazyCallGraph{{.*}}> @@ -136,7 +133,6 @@ ; CHECK-O-NEXT: Running analysis: ScalarEvolutionAnalysis ; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy ; CHECK-O-NEXT: Starting Loop pass manager run. -; CHECK-O-NEXT: Running analysis: PassInstrumentationAnalysis ; CHECK-O-NEXT: Running pass: LoopInstSimplifyPass ; CHECK-O-NEXT: Running pass: LoopSimplifyCFGPass ; CHECK-O-NEXT: Running pass: LoopRotatePass diff --git a/test/Transforms/Inline/cgscc-incremental-invalidate.ll b/test/Transforms/Inline/cgscc-incremental-invalidate.ll index ba9f087a1cb..164f7a66a6f 100644 --- a/test/Transforms/Inline/cgscc-incremental-invalidate.ll +++ b/test/Transforms/Inline/cgscc-incremental-invalidate.ll @@ -33,8 +33,7 @@ ; CHECK-NEXT: Running pass: DominatorTreeVerifierPass on test1_g ; CHECK-NEXT: Running analysis: DominatorTreeAnalysis on test1_g ; CHECK-NEXT: Finished llvm::Function pass manager run. -; CHECK-NOT: Invalidating analysis: -; CHECK: Starting llvm::Function pass manager run. +; CHECK-NEXT: Starting llvm::Function pass manager run. ; CHECK-NEXT: Running pass: DominatorTreeVerifierPass on test1_h ; CHECK-NEXT: Running analysis: DominatorTreeAnalysis on test1_h ; CHECK-NEXT: Finished llvm::Function pass manager run. diff --git a/test/Transforms/LoopRotate/pr35210.ll b/test/Transforms/LoopRotate/pr35210.ll index 3033ca84732..e92ae4b4d8a 100644 --- a/test/Transforms/LoopRotate/pr35210.ll +++ b/test/Transforms/LoopRotate/pr35210.ll @@ -21,7 +21,6 @@ ; CHECK-NEXT: Running analysis: TargetIRAnalysis on f ; CHECK-NEXT: Running analysis: InnerAnalysisManagerProxy{{.*}} on f ; CHECK-NEXT: Starting Loop pass manager run. -; CHECK-NEXT: Running analysis: PassInstrumentationAnalysis on bb ; CHECK-NEXT: Running pass: LoopRotatePass on Loop at depth 1 containing: %bb
,%bb4 ; CHECK-NEXT: Folding loop latch bb4 into bb ; CHECK-NEXT: Invalidating all non-preserved analyses for: bb diff --git a/unittests/Analysis/CGSCCPassManagerTest.cpp b/unittests/Analysis/CGSCCPassManagerTest.cpp index 60da2bbc314..aa0be73fdf2 100644 --- a/unittests/Analysis/CGSCCPassManagerTest.cpp +++ b/unittests/Analysis/CGSCCPassManagerTest.cpp @@ -231,13 +231,6 @@ public: MAM.registerPass([&] { return TargetLibraryAnalysis(); }); MAM.registerPass([&] { return LazyCallGraphAnalysis(); }); MAM.registerPass([&] { return FunctionAnalysisManagerModuleProxy(FAM); }); - - // Register required pass instrumentation analysis. - MAM.registerPass([&] { return PassInstrumentationAnalysis(); }); - CGAM.registerPass([&] { return PassInstrumentationAnalysis(); }); - FAM.registerPass([&] { return PassInstrumentationAnalysis(); }); - - // Cross-register proxies. MAM.registerPass([&] { return CGSCCAnalysisManagerModuleProxy(CGAM); }); CGAM.registerPass([&] { return FunctionAnalysisManagerCGSCCProxy(); }); CGAM.registerPass([&] { return ModuleAnalysisManagerCGSCCProxy(MAM); }); diff --git a/unittests/IR/PassBuilderCallbacksTest.cpp b/unittests/IR/PassBuilderCallbacksTest.cpp index fb01fd11a33..e46fc178150 100644 --- a/unittests/IR/PassBuilderCallbacksTest.cpp +++ b/unittests/IR/PassBuilderCallbacksTest.cpp @@ -7,18 +7,14 @@ // //===----------------------------------------------------------------------===// -#include #include #include -#include #include #include #include #include -#include #include #include -#include #include #include @@ -36,10 +32,7 @@ static std::ostream &operator<<(std::ostream &O, StringRef S) { } namespace { -using testing::AnyNumber; -using testing::AtLeast; using testing::DoDefault; -using testing::Not; using testing::Return; using testing::Expectation; using testing::Invoke; @@ -94,7 +87,6 @@ public: typename Analysis::Result getResult() { return typename Analysis::Result(static_cast(*this)); } - static StringRef getName() { return llvm::getTypeName(); } protected: // FIXME: MSVC seems unable to handle a lambda argument to Invoke from within @@ -151,8 +143,6 @@ public: } }; - static StringRef getName() { return llvm::getTypeName(); } - Pass getPass() { return Pass(static_cast(*this)); } protected: @@ -268,81 +258,6 @@ static std::unique_ptr parseIR(LLVMContext &C, const char *IR) { return parseAssemblyString(IR, Err, C); } -/// Helper for HasName matcher that returns getName both for IRUnit and -/// for IRUnit pointer wrapper into llvm::Any (wrapped by PassInstrumentation). -template StringRef getName(const IRUnitT &IR) { - return IR.getName(); -} - -template <> StringRef getName(const StringRef &name) { return name; } - -template <> StringRef getName(const llvm::Any &WrappedIR) { - if (any_isa(WrappedIR)) - return any_cast(WrappedIR)->getName(); - if (any_isa(WrappedIR)) - return any_cast(WrappedIR)->getName(); - if (any_isa(WrappedIR)) - return any_cast(WrappedIR)->getName(); - if (any_isa(WrappedIR)) - return any_cast(WrappedIR)->getName(); - return ""; -} -/// Define a custom matcher for objects which support a 'getName' method. -/// -/// LLVM often has IR objects or analysis objects which expose a name -/// and in tests it is convenient to match these by name for readability. -/// Usually, this name is either a StringRef or a plain std::string. This -/// matcher supports any type exposing a getName() method of this form whose -/// return value is compatible with an std::ostream. For StringRef, this uses -/// the shift operator defined above. -/// -/// It should be used as: -/// -/// HasName("my_function") -/// -/// No namespace or other qualification is required. -MATCHER_P(HasName, Name, "") { - *result_listener << "has name '" << getName(arg) << "'"; - return Name == getName(arg); -} - -MATCHER_P(HasNameRegex, Name, "") { - *result_listener << "has name '" << getName(arg) << "'"; - llvm::Regex r(Name); - return r.match(getName(arg)); -} - -struct MockPassInstrumentationCallbacks { - PassInstrumentationCallbacks Callbacks; - - MockPassInstrumentationCallbacks() { - ON_CALL(*this, runBeforePass(_, _)).WillByDefault(Return(true)); - } - MOCK_METHOD2(runBeforePass, bool(StringRef PassID, llvm::Any)); - MOCK_METHOD2(runAfterPass, void(StringRef PassID, llvm::Any)); - - void registerPassInstrumentation() { - Callbacks.registerBeforePassCallback([this](StringRef P, llvm::Any IR) { - return this->runBeforePass(P, IR); - }); - Callbacks.registerAfterPassCallback( - [this](StringRef P, llvm::Any IR) { this->runAfterPass(P, IR); }); - } - - void ignoreNonMockPassInstrumentation(StringRef IRName) { - // Generic EXPECT_CALLs are needed to match instrumentation on unimportant - // parts of a pipeline that we do not care about (e.g. various passes added - // by default by PassBuilder - Verifier pass etc). - // Make sure to avoid ignoring Mock passes/analysis, we definitely want - // to check these explicitly. - EXPECT_CALL(*this, - runBeforePass(Not(HasNameRegex("Mock")), HasName(IRName))) - .Times(AnyNumber()); - EXPECT_CALL(*this, runAfterPass(Not(HasNameRegex("Mock")), HasName(IRName))) - .Times(AnyNumber()); - } -}; - template class PassBuilderCallbacksTest; /// This test fixture is shared between all the actual tests below and @@ -365,8 +280,6 @@ protected: LLVMContext Context; std::unique_ptr M; - MockPassInstrumentationCallbacks CallbacksHandle; - PassBuilder PB; ModulePassManager PM; LoopAnalysisManager LAM; @@ -399,7 +312,6 @@ protected: "exit:\n" " ret void\n" "}\n")), - CallbacksHandle(), PB(nullptr, None, &CallbacksHandle.Callbacks), PM(true), LAM(true), FAM(true), CGAM(true), AM(true) { /// Register a callback for analysis registration. @@ -444,6 +356,25 @@ protected: } }; +/// Define a custom matcher for objects which support a 'getName' method. +/// +/// LLVM often has IR objects or analysis objects which expose a name +/// and in tests it is convenient to match these by name for readability. +/// Usually, this name is either a StringRef or a plain std::string. This +/// matcher supports any type exposing a getName() method of this form whose +/// return value is compatible with an std::ostream. For StringRef, this uses +/// the shift operator defined above. +/// +/// It should be used as: +/// +/// HasName("my_function") +/// +/// No namespace or other qualification is required. +MATCHER_P(HasName, Name, "") { + *result_listener << "has name '" << arg.getName() << "'"; + return Name == arg.getName(); +} + using ModuleCallbacksTest = PassBuilderCallbacksTest; using CGSCCCallbacksTest = PassBuilderCallbacksTest; using FunctionCallbacksTest = PassBuilderCallbacksTest; @@ -460,57 +391,6 @@ TEST_F(ModuleCallbacksTest, Passes) { StringRef PipelineText = "test-transform"; ASSERT_TRUE(PB.parsePassPipeline(PM, PipelineText, true)) << "Pipeline was: " << PipelineText; - - PM.run(*M, AM); -} - -TEST_F(ModuleCallbacksTest, InstrumentedPasses) { - EXPECT_CALL(AnalysisHandle, run(HasName(""), _)); - EXPECT_CALL(PassHandle, run(HasName(""), _)) - .WillOnce(Invoke(getAnalysisResult)); - - CallbacksHandle.registerPassInstrumentation(); - // Non-mock instrumentation not specifically mentioned below can be ignored. - CallbacksHandle.ignoreNonMockPassInstrumentation(""); - - // PassInstrumentation calls should happen in-sequence, in the same order - // as passes/analyses are scheduled. - ::testing::Sequence PISequence; - EXPECT_CALL(CallbacksHandle, runBeforePass(HasNameRegex("MockPassHandle"), - HasName(""))) - .InSequence(PISequence); - EXPECT_CALL(CallbacksHandle, - runAfterPass(HasNameRegex("MockPassHandle"), HasName(""))) - .InSequence(PISequence); - - StringRef PipelineText = "test-transform"; - ASSERT_TRUE(PB.parsePassPipeline(PM, PipelineText, true)) - << "Pipeline was: " << PipelineText; - - PM.run(*M, AM); -} - -TEST_F(ModuleCallbacksTest, InstrumentedSkippedPasses) { - CallbacksHandle.registerPassInstrumentation(); - // Non-mock instrumentation run here can safely be ignored. - CallbacksHandle.ignoreNonMockPassInstrumentation(""); - - // Skip the pass by returning false. - EXPECT_CALL(CallbacksHandle, runBeforePass(HasNameRegex("MockPassHandle"), - HasName(""))) - .WillOnce(Return(false)); - - EXPECT_CALL(AnalysisHandle, run(HasName(""), _)).Times(0); - EXPECT_CALL(PassHandle, run(HasName(""), _)).Times(0); - - // As the pass is skipped there is no afterPass as well. - EXPECT_CALL(CallbacksHandle, runAfterPass(HasNameRegex("MockPassHandle"), _)) - .Times(0); - - StringRef PipelineText = "test-transform"; - ASSERT_TRUE(PB.parsePassPipeline(PM, PipelineText, true)) - << "Pipeline was: " << PipelineText; - PM.run(*M, AM); } @@ -525,56 +405,6 @@ TEST_F(FunctionCallbacksTest, Passes) { PM.run(*M, AM); } -TEST_F(FunctionCallbacksTest, InstrumentedPasses) { - CallbacksHandle.registerPassInstrumentation(); - // Non-mock instrumentation not specifically mentioned below can be ignored. - CallbacksHandle.ignoreNonMockPassInstrumentation(""); - CallbacksHandle.ignoreNonMockPassInstrumentation("foo"); - - EXPECT_CALL(AnalysisHandle, run(HasName("foo"), _)); - EXPECT_CALL(PassHandle, run(HasName("foo"), _)) - .WillOnce(Invoke(getAnalysisResult)); - - // PassInstrumentation calls should happen in-sequence, in the same order - // as passes/analyses are scheduled. - ::testing::Sequence PISequence; - EXPECT_CALL(CallbacksHandle, - runBeforePass(HasNameRegex("MockPassHandle"), HasName("foo"))) - .InSequence(PISequence); - EXPECT_CALL(CallbacksHandle, - runAfterPass(HasNameRegex("MockPassHandle"), HasName("foo"))) - .InSequence(PISequence); - - StringRef PipelineText = "test-transform"; - ASSERT_TRUE(PB.parsePassPipeline(PM, PipelineText, true)) - << "Pipeline was: " << PipelineText; - PM.run(*M, AM); -} - -TEST_F(FunctionCallbacksTest, InstrumentedSkippedPasses) { - CallbacksHandle.registerPassInstrumentation(); - // Non-mock instrumentation run here can safely be ignored. - CallbacksHandle.ignoreNonMockPassInstrumentation(""); - CallbacksHandle.ignoreNonMockPassInstrumentation("foo"); - - // Skip the pass by returning false. - EXPECT_CALL(CallbacksHandle, - runBeforePass(HasNameRegex("MockPassHandle"), HasName("foo"))) - .WillOnce(Return(false)); - - EXPECT_CALL(AnalysisHandle, run(HasName("foo"), _)).Times(0); - EXPECT_CALL(PassHandle, run(HasName("foo"), _)).Times(0); - - // As the pass is skipped there is no afterPass as well. - EXPECT_CALL(CallbacksHandle, runAfterPass(HasNameRegex("MockPassHandle"), _)) - .Times(0); - - StringRef PipelineText = "test-transform"; - ASSERT_TRUE(PB.parsePassPipeline(PM, PipelineText, true)) - << "Pipeline was: " << PipelineText; - PM.run(*M, AM); -} - TEST_F(LoopCallbacksTest, Passes) { EXPECT_CALL(AnalysisHandle, run(HasName("loop"), _, _)); EXPECT_CALL(PassHandle, run(HasName("loop"), _, _, _)) @@ -586,58 +416,6 @@ TEST_F(LoopCallbacksTest, Passes) { PM.run(*M, AM); } -TEST_F(LoopCallbacksTest, InstrumentedPasses) { - CallbacksHandle.registerPassInstrumentation(); - // Non-mock instrumentation not specifically mentioned below can be ignored. - CallbacksHandle.ignoreNonMockPassInstrumentation(""); - CallbacksHandle.ignoreNonMockPassInstrumentation("foo"); - CallbacksHandle.ignoreNonMockPassInstrumentation("loop"); - - EXPECT_CALL(AnalysisHandle, run(HasName("loop"), _, _)); - EXPECT_CALL(PassHandle, run(HasName("loop"), _, _, _)) - .WillOnce(WithArgs<0, 1, 2>(Invoke(getAnalysisResult))); - - // PassInstrumentation calls should happen in-sequence, in the same order - // as passes/analyses are scheduled. - ::testing::Sequence PISequence; - EXPECT_CALL(CallbacksHandle, - runBeforePass(HasNameRegex("MockPassHandle"), HasName("loop"))) - .InSequence(PISequence); - EXPECT_CALL(CallbacksHandle, - runAfterPass(HasNameRegex("MockPassHandle"), HasName("loop"))) - .InSequence(PISequence); - - StringRef PipelineText = "test-transform"; - ASSERT_TRUE(PB.parsePassPipeline(PM, PipelineText, true)) - << "Pipeline was: " << PipelineText; - PM.run(*M, AM); -} - -TEST_F(LoopCallbacksTest, InstrumentedSkippedPasses) { - CallbacksHandle.registerPassInstrumentation(); - // Non-mock instrumentation run here can safely be ignored. - CallbacksHandle.ignoreNonMockPassInstrumentation(""); - CallbacksHandle.ignoreNonMockPassInstrumentation("foo"); - CallbacksHandle.ignoreNonMockPassInstrumentation("loop"); - - // Skip the pass by returning false. - EXPECT_CALL(CallbacksHandle, - runBeforePass(HasNameRegex("MockPassHandle"), HasName("loop"))) - .WillOnce(Return(false)); - - EXPECT_CALL(AnalysisHandle, run(HasName("loop"), _, _)).Times(0); - EXPECT_CALL(PassHandle, run(HasName("loop"), _, _, _)).Times(0); - - // As the pass is skipped there is no afterPass as well. - EXPECT_CALL(CallbacksHandle, runAfterPass(HasNameRegex("MockPassHandle"), _)) - .Times(0); - - StringRef PipelineText = "test-transform"; - ASSERT_TRUE(PB.parsePassPipeline(PM, PipelineText, true)) - << "Pipeline was: " << PipelineText; - PM.run(*M, AM); -} - TEST_F(CGSCCCallbacksTest, Passes) { EXPECT_CALL(AnalysisHandle, run(HasName("(foo)"), _, _)); EXPECT_CALL(PassHandle, run(HasName("(foo)"), _, _, _)) @@ -649,57 +427,6 @@ TEST_F(CGSCCCallbacksTest, Passes) { PM.run(*M, AM); } -TEST_F(CGSCCCallbacksTest, InstrumentedPasses) { - CallbacksHandle.registerPassInstrumentation(); - // Non-mock instrumentation not specifically mentioned below can be ignored. - CallbacksHandle.ignoreNonMockPassInstrumentation(""); - CallbacksHandle.ignoreNonMockPassInstrumentation("(foo)"); - - EXPECT_CALL(AnalysisHandle, run(HasName("(foo)"), _, _)); - EXPECT_CALL(PassHandle, run(HasName("(foo)"), _, _, _)) - .WillOnce(WithArgs<0, 1, 2>(Invoke(getAnalysisResult))); - - // PassInstrumentation calls should happen in-sequence, in the same order - // as passes/analyses are scheduled. - ::testing::Sequence PISequence; - EXPECT_CALL(CallbacksHandle, - runBeforePass(HasNameRegex("MockPassHandle"), HasName("(foo)"))) - .InSequence(PISequence); - EXPECT_CALL(CallbacksHandle, - runAfterPass(HasNameRegex("MockPassHandle"), HasName("(foo)"))) - .InSequence(PISequence); - - StringRef PipelineText = "test-transform"; - ASSERT_TRUE(PB.parsePassPipeline(PM, PipelineText, true)) - << "Pipeline was: " << PipelineText; - PM.run(*M, AM); -} - -TEST_F(CGSCCCallbacksTest, InstrumentedSkippedPasses) { - CallbacksHandle.registerPassInstrumentation(); - // Non-mock instrumentation run here can safely be ignored. - CallbacksHandle.ignoreNonMockPassInstrumentation(""); - CallbacksHandle.ignoreNonMockPassInstrumentation("(foo)"); - - // Skip the pass by returning false. - EXPECT_CALL(CallbacksHandle, - runBeforePass(HasNameRegex("MockPassHandle"), HasName("(foo)"))) - .WillOnce(Return(false)); - - // neither Analysis nor Pass are called. - EXPECT_CALL(AnalysisHandle, run(HasName("(foo)"), _, _)).Times(0); - EXPECT_CALL(PassHandle, run(HasName("(foo)"), _, _, _)).Times(0); - - // As the pass is skipped there is no afterPass as well. - EXPECT_CALL(CallbacksHandle, runAfterPass(HasNameRegex("MockPassHandle"), _)) - .Times(0); - - StringRef PipelineText = "test-transform"; - ASSERT_TRUE(PB.parsePassPipeline(PM, PipelineText, true)) - << "Pipeline was: " << PipelineText; - PM.run(*M, AM); -} - /// Test parsing of the names of analysis utilities for our mock analysis /// for all IRUnits. /// diff --git a/unittests/IR/PassManagerTest.cpp b/unittests/IR/PassManagerTest.cpp index 13b87f1022e..7709453cb74 100644 --- a/unittests/IR/PassManagerTest.cpp +++ b/unittests/IR/PassManagerTest.cpp @@ -406,9 +406,6 @@ TEST_F(PassManagerTest, Basic) { MAM.registerPass([&] { return FunctionAnalysisManagerModuleProxy(FAM); }); FAM.registerPass([&] { return ModuleAnalysisManagerFunctionProxy(MAM); }); - MAM.registerPass([&] { return PassInstrumentationAnalysis(); }); - FAM.registerPass([&] { return PassInstrumentationAnalysis(); }); - ModulePassManager MPM; // Count the runs over a Function. @@ -559,8 +556,6 @@ struct CustomizedPass : PassInfoMixin { TEST_F(PassManagerTest, CustomizedPassManagerArgs) { CustomizedAnalysisManager AM; AM.registerPass([&] { return CustomizedAnalysis(); }); - PassInstrumentationCallbacks PIC; - AM.registerPass([&] { return PassInstrumentationAnalysis(&PIC); }); CustomizedPassManager PM; @@ -693,10 +688,6 @@ TEST_F(PassManagerTest, IndirectAnalysisInvalidation) { MAM.registerPass([&] { return FunctionAnalysisManagerModuleProxy(FAM); }); FAM.registerPass([&] { return ModuleAnalysisManagerFunctionProxy(MAM); }); - PassInstrumentationCallbacks PIC; - MAM.registerPass([&] { return PassInstrumentationAnalysis(&PIC); }); - FAM.registerPass([&] { return PassInstrumentationAnalysis(&PIC); }); - int InstrCount = 0, FunctionCount = 0; ModulePassManager MPM(/*DebugLogging*/ true); FunctionPassManager FPM(/*DebugLogging*/ true); diff --git a/unittests/Transforms/Scalar/LoopPassManagerTest.cpp b/unittests/Transforms/Scalar/LoopPassManagerTest.cpp index 9f0b6f0ea03..57fb57ec66c 100644 --- a/unittests/Transforms/Scalar/LoopPassManagerTest.cpp +++ b/unittests/Transforms/Scalar/LoopPassManagerTest.cpp @@ -308,11 +308,6 @@ public: FAM.registerPass([&] { return TargetLibraryAnalysis(); }); FAM.registerPass([&] { return TargetIRAnalysis(); }); - // Register required pass instrumentation analysis. - LAM.registerPass([&] { return PassInstrumentationAnalysis(); }); - FAM.registerPass([&] { return PassInstrumentationAnalysis(); }); - MAM.registerPass([&] { return PassInstrumentationAnalysis(); }); - // Cross-register proxies. LAM.registerPass([&] { return FunctionAnalysisManagerLoopProxy(FAM); }); FAM.registerPass([&] { return LoopAnalysisManagerFunctionProxy(LAM); });