Index: clang/lib/CodeGen/BackendUtil.cpp =================================================================== --- clang/lib/CodeGen/BackendUtil.cpp +++ clang/lib/CodeGen/BackendUtil.cpp @@ -1260,9 +1260,14 @@ PTO.CallGraphProfile = !CodeGenOpts.DisableIntegratedAS; PTO.Coroutines = LangOpts.Coroutines; + LoopAnalysisManager LAM(CodeGenOpts.DebugPassManager); + FunctionAnalysisManager FAM(CodeGenOpts.DebugPassManager); + CGSCCAnalysisManager CGAM(CodeGenOpts.DebugPassManager); + ModuleAnalysisManager MAM(CodeGenOpts.DebugPassManager); + PassInstrumentationCallbacks PIC; StandardInstrumentations SI(CodeGenOpts.DebugPassManager); - SI.registerCallbacks(PIC); + SI.registerCallbacks(PIC, &FAM); PassBuilder PB(CodeGenOpts.DebugPassManager, TM.get(), PTO, PGOOpt, &PIC); // Attempt to load pass plugins and register their callbacks with PB. @@ -1279,11 +1284,6 @@ get##Ext##PluginInfo().RegisterPassBuilderCallbacks(PB); #include "llvm/Support/Extension.def" - LoopAnalysisManager LAM(CodeGenOpts.DebugPassManager); - FunctionAnalysisManager FAM(CodeGenOpts.DebugPassManager); - CGSCCAnalysisManager CGAM(CodeGenOpts.DebugPassManager); - ModuleAnalysisManager MAM(CodeGenOpts.DebugPassManager); - // Register the AA manager first so that our version is the one used. FAM.registerPass([&] { return PB.buildDefaultAAPipeline(); }); Index: llvm/include/llvm/Passes/StandardInstrumentations.h =================================================================== --- llvm/include/llvm/Passes/StandardInstrumentations.h +++ llvm/include/llvm/Passes/StandardInstrumentations.h @@ -91,7 +91,16 @@ }; class PreservedCFGCheckerInstrumentation { -private: +public: + // Keeps sticky poisoned flag for the given basic block once it has been + // deleted or RAUWed. + struct BBGuard final : public CallbackVH { + BBGuard(const BasicBlock *BB) : CallbackVH(BB) {} + void deleted() override { CallbackVH::deleted(); } + void allUsesReplacedWith(Value *) override { CallbackVH::deleted(); } + bool isPoisoned() const { return !getValPtr(); } + }; + // CFG is a map BB -> {(Succ, Multiplicity)}, where BB is a non-leaf basic // block, {(Succ, Multiplicity)} set of all pairs of the block's successors // and the multiplicity of the edge (BB->Succ). As the mapped sets are @@ -101,17 +110,10 @@ // in the Graph (BBGuard). That is if any of the block is deleted or RAUWed // then the CFG is treated poisoned and no block pointer of the Graph is used. struct CFG { - struct BBGuard final : public CallbackVH { - BBGuard(const BasicBlock *BB) : CallbackVH(BB) {} - void deleted() override { CallbackVH::deleted(); } - void allUsesReplacedWith(Value *) override { CallbackVH::deleted(); } - bool isPoisoned() const { return !getValPtr(); } - }; - Optional> BBGuards; DenseMap> Graph; - CFG(const Function *F, bool TrackBBLifetime = false); + CFG(const Function *F, bool TrackBBLifetime); bool operator==(const CFG &G) const { return !isPoisoned() && !G.isPoisoned() && Graph == G.Graph; @@ -128,13 +130,17 @@ static void printDiff(raw_ostream &out, const CFG &Before, const CFG &After); + bool invalidate(Function &F, const PreservedAnalyses &PA, + FunctionAnalysisManager::Invalidator &); }; - SmallVector>, 8> GraphStackBefore; +#ifndef NDEBUG + SmallVector PassStack; +#endif -public: static cl::opt VerifyPreservedCFG; - void registerCallbacks(PassInstrumentationCallbacks &PIC); + void registerCallbacks(PassInstrumentationCallbacks &PIC, + FunctionAnalysisManager &FAM); }; // Base class for classes that report changes to the IR. @@ -412,7 +418,10 @@ public: StandardInstrumentations(bool DebugLogging, bool VerifyEach = false); - void registerCallbacks(PassInstrumentationCallbacks &PIC); + // Register all the standard instrumentation callbacks. If \p FAM is nullptr + // then PreservedCFGChecker is not registeredenabled. + void registerCallbacks(PassInstrumentationCallbacks &PIC, + FunctionAnalysisManager *FAM = nullptr); TimePassesHandler &getTimePasses() { return TimePasses; } }; Index: llvm/lib/LTO/LTOBackend.cpp =================================================================== --- llvm/lib/LTO/LTOBackend.cpp +++ llvm/lib/LTO/LTOBackend.cpp @@ -220,18 +220,18 @@ PGOOptions::IRUse, PGOOptions::CSIRUse); } + LoopAnalysisManager LAM(Conf.DebugPassManager); + FunctionAnalysisManager FAM(Conf.DebugPassManager); + CGSCCAnalysisManager CGAM(Conf.DebugPassManager); + ModuleAnalysisManager MAM(Conf.DebugPassManager); + PassInstrumentationCallbacks PIC; StandardInstrumentations SI(Conf.DebugPassManager); - SI.registerCallbacks(PIC); + SI.registerCallbacks(PIC, &FAM); PassBuilder PB(Conf.DebugPassManager, TM, Conf.PTO, PGOOpt, &PIC); RegisterPassPlugins(Conf.PassPlugins, PB); - LoopAnalysisManager LAM(Conf.DebugPassManager); - FunctionAnalysisManager FAM(Conf.DebugPassManager); - CGSCCAnalysisManager CGAM(Conf.DebugPassManager); - ModuleAnalysisManager MAM(Conf.DebugPassManager); - std::unique_ptr TLII( new TargetLibraryInfoImpl(Triple(TM->getTargetTriple()))); if (Conf.Freestanding) Index: llvm/lib/Passes/StandardInstrumentations.cpp =================================================================== --- llvm/lib/Passes/StandardInstrumentations.cpp +++ llvm/lib/Passes/StandardInstrumentations.cpp @@ -22,6 +22,7 @@ #include "llvm/IR/Function.h" #include "llvm/IR/Module.h" #include "llvm/IR/PassInstrumentation.h" +#include "llvm/IR/PassManager.h" #include "llvm/IR/PrintPasses.h" #include "llvm/IR/Verifier.h" #include "llvm/Support/CommandLine.h" @@ -958,18 +959,6 @@ const CFG &Before, const CFG &After) { assert(!After.isPoisoned()); - - // Print function name. - const CFG *FuncGraph = nullptr; - if (!After.Graph.empty()) - FuncGraph = &After; - else if (!Before.isPoisoned() && !Before.Graph.empty()) - FuncGraph = &Before; - - if (FuncGraph) - out << "In function @" - << FuncGraph->Graph.begin()->first->getParent()->getName() << "\n"; - if (Before.isPoisoned()) { out << "Some blocks were deleted\n"; return; @@ -1025,46 +1014,86 @@ } } +struct PreservedCFGCheckerAnalysis + : public AnalysisInfoMixin { + friend AnalysisInfoMixin; + + static AnalysisKey Key; + +public: + /// Provide the result type for this analysis pass. + using Result = PreservedCFGCheckerInstrumentation::CFG; + + /// Run the analysis pass over a function and produce CFG. + Result run(Function &F, FunctionAnalysisManager &AM) { + return Result(&F, /* TrackBBLifetime */ true); + } +}; + +AnalysisKey PreservedCFGCheckerAnalysis::Key; + +bool PreservedCFGCheckerInstrumentation::CFG::invalidate( + Function &F, const PreservedAnalyses &PA, + FunctionAnalysisManager::Invalidator &) { + auto PAC = PA.getChecker(); + return !(PAC.preserved() || PAC.preservedSet>() || + PAC.preservedSet()); +} + void PreservedCFGCheckerInstrumentation::registerCallbacks( - PassInstrumentationCallbacks &PIC) { + PassInstrumentationCallbacks &PIC, FunctionAnalysisManager &FAM) { if (!VerifyPreservedCFG) return; - PIC.registerBeforeNonSkippedPassCallback([this](StringRef P, Any IR) { - if (any_isa(IR)) - GraphStackBefore.emplace_back(P, CFG(any_cast(IR))); - else - GraphStackBefore.emplace_back(P, None); - }); + FAM.registerPass([&] { return PreservedCFGCheckerAnalysis(); }); + + auto checkCFG = [](StringRef Pass, StringRef FuncName, const CFG &GraphBefore, + const CFG &GraphAfter) { + if (GraphAfter == GraphBefore) + return; + + dbgs() << "Error: " << Pass + << " does not invalidate CFG analyses but CFG changes detected in " + "function @" + << FuncName << ":\n"; + CFG::printDiff(dbgs(), GraphBefore, GraphAfter); + report_fatal_error(Twine("CFG unexpectedly changed by ", Pass)); + }; + + PIC.registerBeforeNonSkippedPassCallback( + [this, &FAM, checkCFG](StringRef P, Any IR) { + assert(&PassStack.emplace_back(P)); + if (!any_isa(IR)) + return; + + const auto *F = any_cast(IR); + FAM.getResult(*const_cast(F)); + }); PIC.registerAfterPassInvalidatedCallback( [this](StringRef P, const PreservedAnalyses &PassPA) { - auto Before = GraphStackBefore.pop_back_val(); - assert(Before.first == P && + assert(PassStack.pop_back_val() == P && "Before and After callbacks must correspond"); - (void)Before; }); - PIC.registerAfterPassCallback([this](StringRef P, Any IR, - const PreservedAnalyses &PassPA) { - auto Before = GraphStackBefore.pop_back_val(); - assert(Before.first == P && "Before and After callbacks must correspond"); - auto &GraphBefore = Before.second; + PIC.registerAfterPassCallback([this, &FAM, + checkCFG](StringRef P, Any IR, + const PreservedAnalyses &PassPA) { + assert(PassStack.pop_back_val() == P && + "Before and After callbacks must correspond"); - if (!PassPA.allAnalysesInSetPreserved()) + if (!any_isa(IR)) return; - if (any_isa(IR)) { - assert(GraphBefore && "Must be built in BeforePassCallback"); - CFG GraphAfter(any_cast(IR), false /* NeedsGuard */); - if (GraphAfter == *GraphBefore) - return; + if (!PassPA.allAnalysesInSetPreserved() && + !PassPA.allAnalysesInSetPreserved>()) + return; - dbgs() << "Error: " << P - << " reported it preserved CFG, but changes detected:\n"; - CFG::printDiff(dbgs(), *GraphBefore, GraphAfter); - report_fatal_error(Twine("Preserved CFG changed by ", P)); - } + const auto *F = any_cast(IR); + if (auto *GraphBefore = FAM.getCachedResult( + *const_cast(F))) + checkCFG(P, F->getName(), *GraphBefore, + CFG(F, /* TrackBBLifetime */ false)); }); } @@ -1169,13 +1198,14 @@ Verify(DebugLogging), VerifyEach(VerifyEach) {} void StandardInstrumentations::registerCallbacks( - PassInstrumentationCallbacks &PIC) { + PassInstrumentationCallbacks &PIC, FunctionAnalysisManager *FAM) { PrintIR.registerCallbacks(PIC); PrintPass.registerCallbacks(PIC); TimePasses.registerCallbacks(PIC); OptNone.registerCallbacks(PIC); OptBisect.registerCallbacks(PIC); - PreservedCFGChecker.registerCallbacks(PIC); + if (FAM) + PreservedCFGChecker.registerCallbacks(PIC, *FAM); PrintChangedIR.registerCallbacks(PIC); PseudoProbeVerification.registerCallbacks(PIC); if (VerifyEach) Index: llvm/test/Other/loop-pm-invalidation.ll =================================================================== --- llvm/test/Other/loop-pm-invalidation.ll +++ llvm/test/Other/loop-pm-invalidation.ll @@ -2,18 +2,18 @@ ; ; Check that we always nuke the LPM stuff when the loops themselves are ; invalidated. -; RUN: opt -disable-output -disable-verify -debug-pass-manager -aa-pipeline= %s 2>&1 \ +; RUN: opt -disable-output -disable-verify -verify-cfg-preserved=0 -debug-pass-manager -aa-pipeline= %s 2>&1 \ ; RUN: -passes='loop(no-op-loop),invalidate,loop(no-op-loop)' \ ; RUN: | FileCheck %s --check-prefix=CHECK-LOOP-INV ; ; If we ended up building the standard analyses, their invalidation should nuke ; stuff as well. -; RUN: opt -disable-output -disable-verify -debug-pass-manager %s -aa-pipeline= 2>&1 \ +; RUN: opt -disable-output -disable-verify -verify-cfg-preserved=0 -debug-pass-manager %s -aa-pipeline= 2>&1 \ ; RUN: -passes='loop(no-op-loop),invalidate,loop(no-op-loop)' \ ; RUN: | FileCheck %s --check-prefix=CHECK-SCEV-INV ; ; Also provide a test that can delete loops after populating analyses for them. -; RUN: opt -disable-output -disable-verify -debug-pass-manager %s -aa-pipeline= 2>&1 \ +; RUN: opt -disable-output -disable-verify -verify-cfg-preserved=0 -debug-pass-manager %s -aa-pipeline= 2>&1 \ ; RUN: -passes='loop(no-op-loop,loop-deletion),invalidate,loop(no-op-loop)' \ ; RUN: | FileCheck %s --check-prefix=CHECK-SCEV-INV-AFTER-DELETE Index: llvm/test/Other/new-pass-manager.ll =================================================================== --- llvm/test/Other/new-pass-manager.ll +++ llvm/test/Other/new-pass-manager.ll @@ -5,17 +5,17 @@ ; files, but for now this is just going to step the new process through its ; paces. -; RUN: opt -disable-output -disable-verify -debug-pass-manager \ +; RUN: opt -disable-output -disable-verify -verify-cfg-preserved=1 -debug-pass-manager \ ; RUN: -passes=no-op-module %s 2>&1 \ ; RUN: | FileCheck %s --check-prefix=CHECK-MODULE-PASS ; CHECK-MODULE-PASS: Starting llvm::Module pass manager run ; CHECK-MODULE-PASS-NEXT: Running pass: NoOpModulePass ; CHECK-MODULE-PASS-NEXT: Finished llvm::Module pass manager run -; RUN: opt -disable-output -disable-verify -debug-pass-manager \ +; RUN: opt -disable-output -disable-verify -verify-cfg-preserved=1 -debug-pass-manager \ ; RUN: -passes=no-op-cgscc %s 2>&1 \ ; RUN: | FileCheck %s --check-prefix=CHECK-CGSCC-PASS -; RUN: opt -disable-output -disable-verify -debug-pass-manager \ +; RUN: opt -disable-output -disable-verify -verify-cfg-preserved=1 -debug-pass-manager \ ; RUN: -passes='cgscc(no-op-cgscc)' %s 2>&1 \ ; RUN: | FileCheck %s --check-prefix=CHECK-CGSCC-PASS ; CHECK-CGSCC-PASS: Starting llvm::Module pass manager run @@ -30,14 +30,15 @@ ; CHECK-CGSCC-PASS-NEXT: Finished CGSCC pass manager run ; CHECK-CGSCC-PASS-NEXT: Finished llvm::Module pass manager run -; RUN: opt -disable-output -disable-verify -debug-pass-manager \ +; RUN: opt -disable-output -disable-verify -verify-cfg-preserved=1 -debug-pass-manager \ ; RUN: -passes=no-op-function %s 2>&1 \ ; RUN: | FileCheck %s --check-prefix=CHECK-FUNCTION-PASS -; RUN: opt -disable-output -disable-verify -debug-pass-manager \ +; RUN: opt -disable-output -disable-verify -verify-cfg-preserved=1 -debug-pass-manager \ ; RUN: -passes='function(no-op-function)' %s 2>&1 \ ; RUN: | FileCheck %s --check-prefix=CHECK-FUNCTION-PASS ; CHECK-FUNCTION-PASS: Starting llvm::Module pass manager run ; CHECK-FUNCTION-PASS-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}> +; CHECK-FUNCTION-PASS-NEXT: Running analysis: PreservedCFGCheckerAnalysis on foo ; 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 @@ -53,7 +54,7 @@ ; CHECK-MODULE-PRINT: Running pass: VerifierPass ; CHECK-MODULE-PRINT: Finished llvm::Module pass manager run -; RUN: opt -disable-output -debug-pass-manager -disable-verify -passes='print,verify' %s 2>&1 \ +; RUN: opt -disable-output -debug-pass-manager -disable-verify -verify-cfg-preserved=1 -passes='print,verify' %s 2>&1 \ ; RUN: | FileCheck %s --check-prefix=CHECK-MODULE-VERIFY ; CHECK-MODULE-VERIFY: Starting llvm::Module pass manager run ; CHECK-MODULE-VERIFY: Running pass: PrintModulePass @@ -75,7 +76,7 @@ ; CHECK-FUNCTION-PRINT: Running pass: VerifierPass ; CHECK-FUNCTION-PRINT: Finished llvm::Module pass manager run -; RUN: opt -disable-output -debug-pass-manager -disable-verify -passes='function(print,verify)' %s 2>&1 \ +; RUN: opt -disable-output -debug-pass-manager -disable-verify -verify-cfg-preserved=1 -passes='function(print,verify)' %s 2>&1 \ ; RUN: | FileCheck %s --check-prefix=CHECK-FUNCTION-VERIFY ; CHECK-FUNCTION-VERIFY: Starting llvm::Module pass manager run ; CHECK-FUNCTION-VERIFY: Starting llvm::Function pass manager run @@ -104,7 +105,7 @@ ; RUN: | llvm-dis \ ; RUN: | FileCheck %s --check-prefix=CHECK-NOOP -; RUN: opt -disable-output -debug-pass-manager -disable-verify -passes='no-op-module,function(no-op-function)' %s 2>&1 \ +; RUN: opt -disable-output -debug-pass-manager -disable-verify -verify-cfg-preserved=1 -passes='no-op-module,function(no-op-function)' %s 2>&1 \ ; RUN: | FileCheck %s --check-prefix=CHECK-NO-VERIFY ; CHECK-NO-VERIFY: Starting llvm::Module pass manager run ; CHECK-NO-VERIFY-NOT: VerifierPass @@ -188,7 +189,7 @@ ; CHECK-DO-INVALIDATE-FUNCTION-ANALYSIS-RESULTS: Invalidating analysis: NoOpFunctionAnalysis ; CHECK-DO-INVALIDATE-FUNCTION-ANALYSIS-RESULTS: Running analysis: NoOpFunctionAnalysis -; RUN: opt -disable-output -disable-verify -debug-pass-manager \ +; RUN: opt -disable-output -disable-verify -verify-cfg-preserved=1 -debug-pass-manager \ ; RUN: -passes='require,module(require,function(require,invalidate,require),require),require' %s 2>&1 \ ; RUN: | FileCheck %s --check-prefix=CHECK-INVALIDATE-ALL ; CHECK-INVALIDATE-ALL: Starting llvm::Module pass manager run @@ -212,7 +213,7 @@ ; CHECK-INVALIDATE-ALL-NOT: Running analysis: NoOpModuleAnalysis ; CHECK-INVALIDATE-ALL: Finished llvm::Module pass manager run -; RUN: opt -disable-output -disable-verify -debug-pass-manager \ +; RUN: opt -disable-output -disable-verify -verify-cfg-preserved=1 -debug-pass-manager \ ; RUN: -passes='require,module(require,cgscc(require,function(require,invalidate,require),require),require),require' %s 2>&1 \ ; RUN: | FileCheck %s --check-prefix=CHECK-INVALIDATE-ALL-CG ; CHECK-INVALIDATE-ALL-CG: Starting llvm::Module pass manager run @@ -245,7 +246,7 @@ ; CHECK-INVALIDATE-ALL-CG-NOT: Running analysis: NoOpModuleAnalysis ; CHECK-INVALIDATE-ALL-CG: Finished llvm::Module pass manager run -; RUN: opt -disable-output -disable-verify -debug-pass-manager %s 2>&1 \ +; RUN: opt -disable-output -disable-verify -verify-cfg-preserved=1 -debug-pass-manager %s 2>&1 \ ; RUN: -passes='require,invalidate,require' \ ; RUN: | FileCheck %s --check-prefix=CHECK-TLI ; CHECK-TLI: Starting llvm::Module pass manager run @@ -257,7 +258,7 @@ ; CHECK-TLI-NOT: Running analysis: TargetLibraryAnalysis ; CHECK-TLI: Finished llvm::Module pass manager run -; RUN: opt -disable-output -disable-verify -debug-pass-manager %s 2>&1 \ +; RUN: opt -disable-output -disable-verify -verify-cfg-preserved=1 -debug-pass-manager %s 2>&1 \ ; RUN: -passes='require,invalidate,require' \ ; RUN: | FileCheck %s --check-prefix=CHECK-TIRA ; CHECK-TIRA: Starting llvm::Module pass manager run @@ -269,7 +270,7 @@ ; CHECK-TIRA-NOT: Running analysis: TargetIRAnalysis ; CHECK-TIRA: Finished llvm::Module pass manager run -; RUN: opt -disable-output -disable-verify -debug-pass-manager %s 2>&1 \ +; RUN: opt -disable-output -disable-verify -verify-cfg-preserved=1 -debug-pass-manager %s 2>&1 \ ; RUN: -passes='require' \ ; RUN: | FileCheck %s --check-prefix=CHECK-DT ; CHECK-DT: Starting llvm::Module pass manager run @@ -277,7 +278,7 @@ ; CHECK-DT: Running analysis: DominatorTreeAnalysis ; CHECK-DT: Finished llvm::Module pass manager run -; RUN: opt -disable-output -disable-verify -debug-pass-manager %s 2>&1 \ +; RUN: opt -disable-output -disable-verify -verify-cfg-preserved=1 -debug-pass-manager %s 2>&1 \ ; RUN: -passes='require' \ ; RUN: | FileCheck %s --check-prefix=CHECK-BASIC-AA ; CHECK-BASIC-AA: Starting llvm::Module pass manager run @@ -285,7 +286,7 @@ ; CHECK-BASIC-AA: Running analysis: BasicAA ; CHECK-BASIC-AA: Finished llvm::Module pass manager run -; RUN: opt -disable-output -disable-verify -debug-pass-manager %s 2>&1 \ +; RUN: opt -disable-output -disable-verify -verify-cfg-preserved=1 -debug-pass-manager %s 2>&1 \ ; RUN: -passes='require' -aa-pipeline='basic-aa' \ ; RUN: | FileCheck %s --check-prefix=CHECK-AA ; CHECK-AA: Starting llvm::Module pass manager run @@ -294,7 +295,7 @@ ; CHECK-AA: Running analysis: BasicAA ; CHECK-AA: Finished llvm::Module pass manager run -; RUN: opt -disable-output -disable-verify -debug-pass-manager %s 2>&1 \ +; RUN: opt -disable-output -disable-verify -verify-cfg-preserved=1 -debug-pass-manager %s 2>&1 \ ; RUN: -passes='require' -aa-pipeline='default' \ ; RUN: | FileCheck %s --check-prefix=CHECK-AA-DEFAULT ; CHECK-AA-DEFAULT: Starting llvm::Module pass manager run @@ -305,7 +306,7 @@ ; CHECK-AA-DEFAULT: Running analysis: TypeBasedAA ; CHECK-AA-DEFAULT: Finished llvm::Module pass manager run -; RUN: opt -disable-output -disable-verify -debug-pass-manager %s 2>&1 \ +; RUN: opt -disable-output -disable-verify -verify-cfg-preserved=1 -debug-pass-manager %s 2>&1 \ ; RUN: -passes='require,invalidate,aa-eval' -aa-pipeline='basic-aa' \ ; RUN: | FileCheck %s --check-prefix=CHECK-AA-FUNCTION-INVALIDATE ; CHECK-AA-FUNCTION-INVALIDATE: Starting llvm::Function pass manager run @@ -321,7 +322,7 @@ ; CHECK-AA-FUNCTION-INVALIDATE: Running analysis: BasicAA ; CHECK-AA-FUNCTION-INVALIDATE: Finished llvm::Function pass manager run -; RUN: opt -disable-output -disable-verify -debug-pass-manager %s 2>&1 \ +; RUN: opt -disable-output -disable-verify -verify-cfg-preserved=1 -debug-pass-manager %s 2>&1 \ ; RUN: -passes='require,function(require),invalidate,require,function(aa-eval)' -aa-pipeline='globals-aa' \ ; RUN: | FileCheck %s --check-prefix=CHECK-AA-MODULE-INVALIDATE ; CHECK-AA-MODULE-INVALIDATE: Starting llvm::Module pass manager run @@ -340,7 +341,7 @@ ; CHECK-AA-MODULE-INVALIDATE: Finished llvm::Function pass manager run ; CHECK-AA-MODULE-INVALIDATE: Finished llvm::Module pass manager run -; RUN: opt -disable-output -disable-verify -debug-pass-manager %s 2>&1 \ +; RUN: opt -disable-output -disable-verify -verify-cfg-preserved=1 -debug-pass-manager %s 2>&1 \ ; RUN: -passes='require' \ ; RUN: | FileCheck %s --check-prefix=CHECK-MEMDEP ; CHECK-MEMDEP: Starting llvm::Module pass manager run @@ -348,7 +349,7 @@ ; CHECK-MEMDEP: Running analysis: MemoryDependenceAnalysis ; CHECK-MEMDEP: Finished llvm::Module pass manager run -; RUN: opt -disable-output -disable-verify -debug-pass-manager %s 2>&1 \ +; RUN: opt -disable-output -disable-verify -verify-cfg-preserved=1 -debug-pass-manager %s 2>&1 \ ; RUN: -passes='require' \ ; RUN: | FileCheck %s --check-prefix=CHECK-CALLGRAPH ; CHECK-CALLGRAPH: Starting llvm::Module pass manager run @@ -356,7 +357,7 @@ ; CHECK-CALLGRAPH: Running analysis: CallGraphAnalysis ; CHECK-CALLGRAPH: Finished llvm::Module pass manager run -; RUN: opt -disable-output -disable-verify -debug-pass-manager \ +; RUN: opt -disable-output -disable-verify -verify-cfg-preserved=1 -debug-pass-manager \ ; RUN: -passes='default' %s 2>&1 \ ; RUN: | FileCheck %s --check-prefix=CHECK-O0 --check-prefix=%llvmcheckext ; CHECK-O0: Starting llvm::Module pass manager run @@ -371,7 +372,7 @@ ; CHECK-NOEXT: {{.*}} ; CHECK-O0-NEXT: Finished llvm::Module pass manager run -; RUN: opt -disable-output -disable-verify -debug-pass-manager \ +; RUN: opt -disable-output -disable-verify -verify-cfg-preserved=1 -debug-pass-manager \ ; RUN: -passes='repeat<3>(no-op-module)' %s 2>&1 \ ; RUN: | FileCheck %s --check-prefix=CHECK-REPEAT-MODULE-PASS ; CHECK-REPEAT-MODULE-PASS: Starting llvm::Module pass manager run @@ -387,7 +388,7 @@ ; CHECK-REPEAT-MODULE-PASS-NEXT: Finished llvm::Module pass manager run ; CHECK-REPEAT-MODULE-PASS-NEXT: Finished llvm::Module pass manager run -; RUN: opt -disable-output -disable-verify -debug-pass-manager \ +; RUN: opt -disable-output -disable-verify -verify-cfg-preserved=1 -debug-pass-manager \ ; RUN: -passes='cgscc(repeat<3>(no-op-cgscc))' %s 2>&1 \ ; RUN: | FileCheck %s --check-prefix=CHECK-REPEAT-CGSCC-PASS ; CHECK-REPEAT-CGSCC-PASS: Starting llvm::Module pass manager run @@ -411,11 +412,12 @@ ; CHECK-REPEAT-CGSCC-PASS-NEXT: Finished CGSCC pass manager run ; CHECK-REPEAT-CGSCC-PASS-NEXT: Finished llvm::Module pass manager run -; RUN: opt -disable-output -disable-verify -debug-pass-manager \ +; RUN: opt -disable-output -disable-verify -verify-cfg-preserved=1 -debug-pass-manager \ ; RUN: -passes='function(repeat<3>(no-op-function))' %s 2>&1 \ ; RUN: | FileCheck %s --check-prefix=CHECK-REPEAT-FUNCTION-PASS ; CHECK-REPEAT-FUNCTION-PASS: Starting llvm::Module pass manager run ; CHECK-REPEAT-FUNCTION-PASS-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}> +; CHECK-REPEAT-FUNCTION-PASS-NEXT: Running analysis: PreservedCFGCheckerAnalysis on foo ; 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 @@ -430,18 +432,21 @@ ; CHECK-REPEAT-FUNCTION-PASS-NEXT: Finished llvm::Function pass manager run ; CHECK-REPEAT-FUNCTION-PASS-NEXT: Finished llvm::Module pass manager run -; RUN: opt -disable-output -disable-verify -debug-pass-manager \ +; RUN: opt -disable-output -disable-verify -verify-cfg-preserved=1 -debug-pass-manager \ ; RUN: -passes='loop(repeat<3>(no-op-loop))' %s 2>&1 \ ; RUN: | FileCheck %s --check-prefix=CHECK-REPEAT-LOOP-PASS ; CHECK-REPEAT-LOOP-PASS: Starting llvm::Module pass manager run ; CHECK-REPEAT-LOOP-PASS-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}> +; CHECK-REPEAT-LOOP-PASS-NEXT: Running analysis: PreservedCFGCheckerAnalysis on foo ; CHECK-REPEAT-LOOP-PASS-NEXT: Starting llvm::Function pass manager run ; CHECK-REPEAT-LOOP-PASS-NEXT: Starting llvm::Function pass manager run ; CHECK-REPEAT-LOOP-PASS-NEXT: Running pass: LoopSimplify ; CHECK-REPEAT-LOOP-PASS-NEXT: Running analysis: LoopAnalysis ; CHECK-REPEAT-LOOP-PASS-NEXT: Running analysis: DominatorTreeAnalysis ; CHECK-REPEAT-LOOP-PASS-NEXT: Running analysis: AssumptionAnalysis +; CHECK-REPEAT-LOOP-PASS-NEXT: Invalidating analysis: PreservedCFGCheckerAnalysis on foo ; CHECK-REPEAT-LOOP-PASS-NEXT: Running pass: LCSSAPass +; CHECK-REPEAT-LOOP-PASS-NEXT: Running analysis: PreservedCFGCheckerAnalysis on foo ; CHECK-REPEAT-LOOP-PASS-NEXT: Finished llvm::Function pass manager run ; CHECK-REPEAT-LOOP-PASS-NEXT: Running analysis: AAManager ; CHECK-REPEAT-LOOP-PASS-NEXT: Running analysis: TargetLibraryAnalysis Index: llvm/test/Other/new-pm-O0-defaults.ll =================================================================== --- llvm/test/Other/new-pm-O0-defaults.ll +++ llvm/test/Other/new-pm-O0-defaults.ll @@ -7,22 +7,22 @@ ; Any invalidation that shows up here is a bug, unless we started modifying ; the IR, in which case we need to make it immutable harder. -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager \ ; RUN: -passes='default' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-DEFAULT -; RUN: opt -disable-verify -debug-pass-manager -enable-matrix \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager -enable-matrix \ ; RUN: -passes='default' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-DEFAULT,CHECK-MATRIX -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager \ ; RUN: -passes='thinlto-pre-link' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-DEFAULT,CHECK-PRE-LINK -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager \ ; RUN: -passes='lto-pre-link' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-DEFAULT,CHECK-PRE-LINK -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager \ ; RUN: -passes='thinlto' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-THINLTO -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager \ ; RUN: -passes='lto' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-LTO Index: llvm/test/Other/new-pm-defaults.ll =================================================================== --- llvm/test/Other/new-pm-defaults.ll +++ llvm/test/Other/new-pm-defaults.ll @@ -7,62 +7,62 @@ ; Any invalidation that shows up here is a bug, unless we started modifying ; the IR, in which case we need to make it immutable harder. -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=1 -debug-pass-manager \ ; RUN: -passes='default' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-DEFAULT,CHECK-O1,%llvmcheckext -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=1 -debug-pass-manager \ ; RUN: -passes='default' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-DEFAULT,CHECK-O2,CHECK-O23SZ,%llvmcheckext -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=1 -debug-pass-manager \ ; RUN: -passes='default' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-DEFAULT,CHECK-O3,CHECK-O23SZ,%llvmcheckext -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=1 -debug-pass-manager \ ; RUN: -passes='default' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-DEFAULT,CHECK-Os,CHECK-O23SZ,%llvmcheckext -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=1 -debug-pass-manager \ ; RUN: -passes='default' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-DEFAULT,CHECK-Oz,CHECK-O23SZ,%llvmcheckext -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=1 -debug-pass-manager \ ; RUN: -passes='lto-pre-link' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-LTO,CHECK-O2,CHECK-O23SZ,%llvmcheckext -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=1 -debug-pass-manager \ ; RUN: -passes-ep-peephole='no-op-function' \ ; RUN: -passes='default' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-DEFAULT,CHECK-O3,%llvmcheckext,CHECK-EP-PEEPHOLE,CHECK-O23SZ -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=1 -debug-pass-manager \ ; RUN: -passes-ep-late-loop-optimizations='no-op-loop' \ ; RUN: -passes='default' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-DEFAULT,CHECK-O3,%llvmcheckext,CHECK-EP-LOOP-LATE,CHECK-O23SZ -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=1 -debug-pass-manager \ ; RUN: -passes-ep-loop-optimizer-end='no-op-loop' \ ; RUN: -passes='default' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-DEFAULT,CHECK-O3,%llvmcheckext,CHECK-EP-LOOP-END,CHECK-O23SZ -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=1 -debug-pass-manager \ ; RUN: -passes-ep-scalar-optimizer-late='no-op-function' \ ; RUN: -passes='default' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-DEFAULT,CHECK-O3,%llvmcheckext,CHECK-EP-SCALAR-LATE,CHECK-O23SZ -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=1 -debug-pass-manager \ ; RUN: -passes-ep-cgscc-optimizer-late='no-op-cgscc' \ ; RUN: -passes='default' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-DEFAULT,CHECK-O3,%llvmcheckext,CHECK-EP-CGSCC-LATE,CHECK-O23SZ -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=1 -debug-pass-manager \ ; RUN: -passes-ep-vectorizer-start='no-op-function' \ ; RUN: -passes='default' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-DEFAULT,CHECK-O3,%llvmcheckext,CHECK-EP-VECTORIZER-START,CHECK-O23SZ -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=1 -debug-pass-manager \ ; RUN: -passes-ep-pipeline-start='no-op-module' \ ; RUN: -passes='default' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-DEFAULT,CHECK-O3,%llvmcheckext,CHECK-EP-PIPELINE-START,CHECK-O23SZ -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=1 -debug-pass-manager \ ; RUN: -passes-ep-pipeline-early-simplification='no-op-module' \ ; RUN: -passes='default' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-DEFAULT,CHECK-O3,%llvmcheckext,CHECK-EP-PIPELINE-EARLY-SIMPLIFICATION,CHECK-O23SZ -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=1 -debug-pass-manager \ ; RUN: -passes-ep-pipeline-start='no-op-module' \ ; RUN: -passes='lto-pre-link' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-LTO,CHECK-O3,%llvmcheckext,CHECK-EP-PIPELINE-START,CHECK-O23SZ -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=1 -debug-pass-manager \ ; RUN: -passes-ep-optimizer-last='no-op-function' \ ; RUN: -passes='default' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-DEFAULT,CHECK-O3,%llvmcheckext,CHECK-EP-OPTIMIZER-LAST,CHECK-O23SZ @@ -77,6 +77,7 @@ ; CHECK-O-NEXT: Running pass: InferFunctionAttrsPass ; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy ; CHECK-O-NEXT: Running analysis: TargetLibraryAnalysis +; CHECK-O-NEXT: Running analysis: PreservedCFGCheckerAnalysis on foo ; CHECK-O-NEXT: Starting llvm::Function pass manager run. ; CHECK-O-NEXT: Running pass: SimplifyCFGPass ; CHECK-O-NEXT: Running analysis: TargetIRAnalysis Index: llvm/test/Other/new-pm-lto-defaults.ll =================================================================== --- llvm/test/Other/new-pm-lto-defaults.ll +++ llvm/test/Other/new-pm-lto-defaults.ll @@ -2,25 +2,25 @@ ; For now the only difference is between -O1 and everything else, so ; -O2, -O3, -Os, -Oz are the same. -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager \ ; RUN: -passes='lto' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O1 -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager \ ; RUN: -passes='lto' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O23SZ \ ; RUN: --check-prefix=CHECK-O2 -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager \ ; RUN: -passes='lto' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O23SZ \ ; RUN: --check-prefix=CHECK-O3 -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager \ ; RUN: -passes='lto' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O23SZ \ ; RUN: --check-prefix=CHECK-OS -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager \ ; RUN: -passes='lto' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O23SZ -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager \ ; RUN: -passes='lto' -S %s -passes-ep-peephole='no-op-function' 2>&1 \ ; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O23SZ \ ; RUN: --check-prefix=CHECK-O3 --check-prefix=CHECK-EP-Peephole Index: llvm/test/Other/new-pm-thinlto-defaults.ll =================================================================== --- llvm/test/Other/new-pm-thinlto-defaults.ll +++ llvm/test/Other/new-pm-thinlto-defaults.ll @@ -8,42 +8,42 @@ ; the IR, in which case we need to make it immutable harder. ; ; Prelink pipelines: -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager \ ; RUN: -passes='thinlto-pre-link' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O1,CHECK-PRELINK-O,CHECK-PRELINK-O-NODIS -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager \ ; RUN: -passes='thinlto-pre-link' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O2,CHECK-O23SZ,CHECK-PRELINK-O,CHECK-PRELINK-O-NODIS -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager \ ; RUN: -passes='thinlto-pre-link' -S -passes-ep-pipeline-start='no-op-module' %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O3,CHECK-O23SZ,CHECK-PRELINK-O,CHECK-PRELINK-O-NODIS,CHECK-EP-PIPELINE-START -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager \ ; RUN: -passes='thinlto-pre-link' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-Os,CHECK-O23SZ,CHECK-PRELINK-O,CHECK-PRELINK-O-NODIS -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager \ ; RUN: -passes='thinlto-pre-link' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-Oz,CHECK-O23SZ,CHECK-PRELINK-O,CHECK-PRELINK-O-NODIS -; RUN: opt -disable-verify -debug-pass-manager -new-pm-debug-info-for-profiling \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager -new-pm-debug-info-for-profiling \ ; RUN: -passes='thinlto-pre-link' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-DIS,CHECK-O,CHECK-O2,CHECK-O23SZ,CHECK-PRELINK-O ; ; Postlink pipelines: -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager \ ; RUN: -passes='thinlto' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O1,CHECK-POSTLINK-O,%llvmcheckext -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager \ ; RUN: -passes='thinlto' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O2,CHECK-O23SZ,CHECK-POSTLINK-O,%llvmcheckext,CHECK-POSTLINK-O2 -; RUN: opt -disable-verify -debug-pass-manager -passes-ep-pipeline-start='no-op-module' \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager -passes-ep-pipeline-start='no-op-module' \ ; RUN: -passes='thinlto' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O3,CHECK-O23SZ,CHECK-POSTLINK-O,%llvmcheckext,CHECK-POSTLINK-O3 -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager \ ; RUN: -passes='thinlto' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-Os,CHECK-O23SZ,CHECK-POSTLINK-O,%llvmcheckext,CHECK-POSTLINK-Os -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager \ ; RUN: -passes='thinlto' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-Oz,CHECK-O23SZ,CHECK-POSTLINK-O,%llvmcheckext -; RUN: opt -disable-verify -debug-pass-manager -new-pm-debug-info-for-profiling \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager -new-pm-debug-info-for-profiling \ ; RUN: -passes='thinlto' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O2,CHECK-O23SZ,CHECK-POSTLINK-O,%llvmcheckext,CHECK-POSTLINK-O2 Index: llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll =================================================================== --- llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll +++ llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll @@ -1,22 +1,22 @@ ; Validate ThinLTO post link pipeline when we have instrumentation PGO ; ; Postlink pipelines: -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager \ ; RUN: -passes='thinlto' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O1,%llvmcheckext -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager \ ; RUN: -passes='thinlto' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O2,CHECK-O23SZ,%llvmcheckext -; RUN: opt -disable-verify -debug-pass-manager -passes-ep-pipeline-start='no-op-module' \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager -passes-ep-pipeline-start='no-op-module' \ ; RUN: -passes='thinlto' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O3,CHECK-O23SZ,%llvmcheckext -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager \ ; RUN: -passes='thinlto' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-Os,CHECK-O23SZ,%llvmcheckext -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager \ ; RUN: -passes='thinlto' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-Oz,CHECK-O23SZ,%llvmcheckext -; RUN: opt -disable-verify -debug-pass-manager -new-pm-debug-info-for-profiling \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager -new-pm-debug-info-for-profiling \ ; RUN: -passes='thinlto' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O2,CHECK-O23SZ,%llvmcheckext Index: llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll =================================================================== --- llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll +++ llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll @@ -1,26 +1,26 @@ ; Validate ThinLTO postlink pipeline when we have Sample PGO ; -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager \ ; RUN: -pgo-kind=pgo-sample-use-pipeline -profile-file='%S/Inputs/new-pm-thinlto-samplepgo-defaults.prof' \ ; RUN: -passes='thinlto' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O1,%llvmcheckext -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager \ ; RUN: -pgo-kind=pgo-sample-use-pipeline -profile-file='%S/Inputs/new-pm-thinlto-samplepgo-defaults.prof' \ ; RUN: -passes='thinlto' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O2,CHECK-O23SZ,%llvmcheckext -; RUN: opt -disable-verify -debug-pass-manager -passes-ep-pipeline-start='no-op-module' \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager -passes-ep-pipeline-start='no-op-module' \ ; RUN: -pgo-kind=pgo-sample-use-pipeline -profile-file='%S/Inputs/new-pm-thinlto-samplepgo-defaults.prof' \ ; RUN: -passes='thinlto' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O3,CHECK-O23SZ,%llvmcheckext -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager \ ; RUN: -pgo-kind=pgo-sample-use-pipeline -profile-file='%S/Inputs/new-pm-thinlto-samplepgo-defaults.prof' \ ; RUN: -passes='thinlto' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-Os,CHECK-O23SZ,%llvmcheckext -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager \ ; RUN: -pgo-kind=pgo-sample-use-pipeline -profile-file='%S/Inputs/new-pm-thinlto-samplepgo-defaults.prof' \ ; RUN: -passes='thinlto' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-Oz,CHECK-O23SZ,%llvmcheckext -; RUN: opt -disable-verify -debug-pass-manager -new-pm-debug-info-for-profiling \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager -new-pm-debug-info-for-profiling \ ; RUN: -pgo-kind=pgo-sample-use-pipeline -profile-file='%S/Inputs/new-pm-thinlto-samplepgo-defaults.prof' \ ; RUN: -passes='thinlto' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O2,CHECK-O23SZ,%llvmcheckext Index: llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll =================================================================== --- llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll +++ llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll @@ -2,27 +2,27 @@ ; ; RUN: llvm-profdata merge %S/Inputs/new-pm-thinlto-prelink-pgo-defaults.proftext -o %t.profdata ; -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager \ ; RUN: -pgo-kind=pgo-instr-use-pipeline -profile-file='%t.profdata' \ ; RUN: -passes='thinlto-pre-link' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O1,CHECK-O123SZ -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager \ ; RUN: -pgo-kind=pgo-instr-use-pipeline -profile-file='%t.profdata' \ ; RUN: -passes='thinlto-pre-link' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O2,CHECK-O23SZ,CHECK-O123SZ -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager \ ; RUN: -pgo-kind=pgo-instr-use-pipeline -profile-file='%t.profdata' \ ; RUN: -passes='thinlto-pre-link' -S -passes-ep-pipeline-start='no-op-module' %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O3,CHECK-O23SZ,CHECK-O123SZ,CHECK-EP-PIPELINE-START -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager \ ; RUN: -pgo-kind=pgo-instr-use-pipeline -profile-file='%t.profdata' \ ; RUN: -passes='thinlto-pre-link' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O123SZ,CHECK-Os,CHECK-O23SZ -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager \ ; RUN: -pgo-kind=pgo-instr-use-pipeline -profile-file='%t.profdata' \ ; RUN: -passes='thinlto-pre-link' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O123SZ,CHECK-Oz,CHECK-O23SZ -; RUN: opt -disable-verify -debug-pass-manager -new-pm-debug-info-for-profiling \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager -new-pm-debug-info-for-profiling \ ; RUN: -pgo-kind=pgo-instr-use-pipeline -profile-file='%t.profdata' \ ; RUN: -passes='thinlto-pre-link' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O2,CHECK-O23SZ,CHECK-O123SZ Index: llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll =================================================================== --- llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll +++ llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll @@ -1,26 +1,26 @@ ; Validate ThinLTO prelink pipeline when we have Sample PGO ; -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager \ ; RUN: -pgo-kind=pgo-sample-use-pipeline -profile-file='%S/Inputs/new-pm-thinlto-samplepgo-defaults.prof' \ ; RUN: -passes='thinlto-pre-link' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O1 -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager \ ; RUN: -pgo-kind=pgo-sample-use-pipeline -profile-file='%S/Inputs/new-pm-thinlto-samplepgo-defaults.prof' \ ; RUN: -passes='thinlto-pre-link' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O2,CHECK-O23SZ -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager \ ; RUN: -pgo-kind=pgo-sample-use-pipeline -profile-file='%S/Inputs/new-pm-thinlto-samplepgo-defaults.prof' \ ; RUN: -passes='thinlto-pre-link' -S -passes-ep-pipeline-start='no-op-module' %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O3,CHECK-O23SZ,CHECK-EP-PIPELINE-START -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager \ ; RUN: -pgo-kind=pgo-sample-use-pipeline -profile-file='%S/Inputs/new-pm-thinlto-samplepgo-defaults.prof' \ ; RUN: -passes='thinlto-pre-link' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-Os,CHECK-O23SZ -; RUN: opt -disable-verify -debug-pass-manager \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager \ ; RUN: -pgo-kind=pgo-sample-use-pipeline -profile-file='%S/Inputs/new-pm-thinlto-samplepgo-defaults.prof' \ ; RUN: -passes='thinlto-pre-link' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-Oz,CHECK-O23SZ -; RUN: opt -disable-verify -debug-pass-manager -new-pm-debug-info-for-profiling \ +; RUN: opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager -new-pm-debug-info-for-profiling \ ; RUN: -pgo-kind=pgo-sample-use-pipeline -profile-file='%S/Inputs/new-pm-thinlto-samplepgo-defaults.prof' \ ; RUN: -passes='thinlto-pre-link' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O2,CHECK-O23SZ Index: llvm/test/Transforms/LoopRotate/pr35210.ll =================================================================== --- llvm/test/Transforms/LoopRotate/pr35210.ll +++ llvm/test/Transforms/LoopRotate/pr35210.ll @@ -1,5 +1,5 @@ -;RUN: opt %s -aa-pipeline= -passes='adce,loop(loop-rotate),adce' -S -debug-pass-manager -debug-only=loop-rotate 2>&1 | FileCheck %s -;RUN: opt %s -aa-pipeline= -passes='adce,loop-mssa(loop-rotate),adce' -S -debug-pass-manager -debug-only=loop-rotate -verify-memoryssa 2>&1 | FileCheck %s --check-prefix=MSSA +;RUN: opt %s -aa-pipeline= -passes='adce,loop(loop-rotate),adce' -S -verify-cfg-preserved=0 -debug-pass-manager -debug-only=loop-rotate 2>&1 | FileCheck %s +;RUN: opt %s -aa-pipeline= -passes='adce,loop-mssa(loop-rotate),adce' -S -verify-cfg-preserved=0 -debug-pass-manager -debug-only=loop-rotate -verify-memoryssa 2>&1 | FileCheck %s --check-prefix=MSSA ;REQUIRES: asserts ; This test is to make sure we invalidate the post dominator pass after loop rotate simplifies the loop latch. Index: llvm/test/Transforms/SCCP/ipsccp-preserve-analysis.ll =================================================================== --- llvm/test/Transforms/SCCP/ipsccp-preserve-analysis.ll +++ llvm/test/Transforms/SCCP/ipsccp-preserve-analysis.ll @@ -16,7 +16,7 @@ ; NEW-PM: Running pass: IPSCCPPass ; NEW-PM-DAG: Running analysis: AssumptionAnalysis on f1 ; NEW-PM-DAG: Running analysis: AssumptionAnalysis on f2 -; NEW-PM-NOT: Running analysis: +; NEW-PM-NOT: Running analysis: AssumptionAnalysis ; IR-LABEL: @f1 ; IR-LABEL: entry: Index: llvm/tools/opt/NewPMDriver.cpp =================================================================== --- llvm/tools/opt/NewPMDriver.cpp +++ llvm/tools/opt/NewPMDriver.cpp @@ -275,9 +275,14 @@ P->CSAction = PGOOptions::CSIRUse; } } + LoopAnalysisManager LAM(DebugPM); + FunctionAnalysisManager FAM(DebugPM); + CGSCCAnalysisManager CGAM(DebugPM); + ModuleAnalysisManager MAM(DebugPM); + PassInstrumentationCallbacks PIC; StandardInstrumentations SI(DebugPM, VerifyEachPass); - SI.registerCallbacks(PIC); + SI.registerCallbacks(PIC, &FAM); DebugifyEachInstrumentation Debugify; if (DebugifyEach) Debugify.registerCallbacks(PIC); @@ -373,11 +378,6 @@ } } - LoopAnalysisManager LAM(DebugPM); - FunctionAnalysisManager FAM(DebugPM); - CGSCCAnalysisManager CGAM(DebugPM); - ModuleAnalysisManager MAM(DebugPM); - // Register the AA manager first so that our version is the one used. FAM.registerPass([&] { return std::move(AA); }); // Register our TargetLibraryInfoImpl. Index: llvm/unittests/IR/PassManagerTest.cpp =================================================================== --- llvm/unittests/IR/PassManagerTest.cpp +++ llvm/unittests/IR/PassManagerTest.cpp @@ -827,7 +827,7 @@ FunctionPassManager FPM(/*DebugLogging*/ true); PassInstrumentationCallbacks PIC; StandardInstrumentations SI(/*DebugLogging*/ true); - SI.registerCallbacks(PIC); + SI.registerCallbacks(PIC, &FAM); FAM.registerPass([&] { return PassInstrumentationAnalysis(&PIC); }); FAM.registerPass([&] { return DominatorTreeAnalysis(); }); FAM.registerPass([&] { return AssumptionAnalysis(); }); @@ -873,7 +873,7 @@ FunctionPassManager FPM(/*DebugLogging*/ true); PassInstrumentationCallbacks PIC; StandardInstrumentations SI(/*DebugLogging*/ true); - SI.registerCallbacks(PIC); + SI.registerCallbacks(PIC, &FAM); FAM.registerPass([&] { return PassInstrumentationAnalysis(&PIC); }); FAM.registerPass([&] { return DominatorTreeAnalysis(); }); FAM.registerPass([&] { return AssumptionAnalysis(); }); @@ -938,7 +938,7 @@ FunctionPassManager FPM(/*DebugLogging*/ true); PassInstrumentationCallbacks PIC; StandardInstrumentations SI(/*DebugLogging*/ true); - SI.registerCallbacks(PIC); + SI.registerCallbacks(PIC, &FAM); FAM.registerPass([&] { return PassInstrumentationAnalysis(&PIC); }); FAM.registerPass([&] { return DominatorTreeAnalysis(); }); FAM.registerPass([&] { return AssumptionAnalysis(); });