[llvm] 72badbc - [NPM] Move more O0 pass building into PassBuilder
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 19 11:22:41 PST 2020
Author: Arthur Eubanks
Date: 2020-11-19T11:22:23-08:00
New Revision: 72badbcdccd11c12555147d48dee4a776f5da87d
URL: https://github.com/llvm/llvm-project/commit/72badbcdccd11c12555147d48dee4a776f5da87d
DIFF: https://github.com/llvm/llvm-project/commit/72badbcdccd11c12555147d48dee4a776f5da87d.diff
LOG: [NPM] Move more O0 pass building into PassBuilder
This moves handling of alwaysinline, coroutines, matrix lowering, PGO,
and LTO-required passes into PassBuilder. Much of this is replicated
between Clang and opt. Other out-of-tree users also replicate some of
this, such as Rust [1] replicating the alwaysinline, LTO, and PGO
passes.
The LTO passes are also now run in
build(Thin)LTOPreLinkDefaultPipeline() since they are semantically
required for (Thin)LTO.
[1]: https://github.com/rust-lang/rust/blob/f5230fbf76bafd86ee4376a0e26e551df8d17fec/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp#L896
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D91585
Added:
llvm/test/Other/new-pm-O0-defaults.ll
Modified:
clang/lib/CodeGen/BackendUtil.cpp
llvm/include/llvm/Passes/PassBuilder.h
llvm/lib/Passes/PassBuilder.cpp
llvm/test/Other/new-pass-manager.ll
llvm/test/Other/new-pm-defaults.ll
llvm/test/Other/new-pm-pgo-O0.ll
llvm/test/Other/new-pm-thinlto-defaults.ll
llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
llvm/test/Transforms/CanonicalizeAliases/canonicalize.ll
llvm/test/Transforms/NameAnonGlobals/rename.ll
Removed:
################################################################################
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index 77759bb18146..816eaf3bf27e 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -1047,22 +1047,6 @@ static PassBuilder::OptimizationLevel mapToLevel(const CodeGenOptions &Opts) {
}
}
-static void addCoroutinePassesAtO0(ModulePassManager &MPM,
- const LangOptions &LangOpts,
- const CodeGenOptions &CodeGenOpts) {
- if (!LangOpts.Coroutines)
- return;
-
- MPM.addPass(createModuleToFunctionPassAdaptor(CoroEarlyPass()));
-
- CGSCCPassManager CGPM(CodeGenOpts.DebugPassManager);
- CGPM.addPass(CoroSplitPass());
- CGPM.addPass(createCGSCCToFunctionPassAdaptor(CoroElidePass()));
- MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(std::move(CGPM)));
-
- MPM.addPass(createModuleToFunctionPassAdaptor(CoroCleanupPass()));
-}
-
/// A clean version of `EmitAssembly` that uses the new pass manager.
///
/// Not all features are currently supported in this system, but where
@@ -1319,38 +1303,7 @@ void EmitAssemblyHelper::EmitAssemblyWithNewPassManager(
});
if (CodeGenOpts.OptimizationLevel == 0) {
- // Build a minimal pipeline based on the semantics required by Clang,
- // which is just that always inlining occurs. Further, disable generating
- // lifetime intrinsics to avoid enabling further optimizations during
- // code generation.
- // However, we need to insert lifetime intrinsics to avoid invalid access
- // caused by multithreaded coroutines.
- PB.registerPipelineStartEPCallback(
- [this](ModulePassManager &MPM, PassBuilder::OptimizationLevel Level) {
- MPM.addPass(AlwaysInlinerPass(
- /*InsertLifetimeIntrinsics=*/LangOpts.Coroutines));
- });
-
- // At -O0, we can still do PGO. Add all the requested passes for
- // instrumentation PGO, if requested.
- if (PGOOpt && (PGOOpt->Action == PGOOptions::IRInstr ||
- PGOOpt->Action == PGOOptions::IRUse))
- PB.addPGOInstrPassesForO0(
- MPM,
- /* RunProfileGen */ (PGOOpt->Action == PGOOptions::IRInstr),
- /* IsCS */ false, PGOOpt->ProfileFile,
- PGOOpt->ProfileRemappingFile);
-
- PB.runRegisteredEPCallbacks(MPM, Level, CodeGenOpts.DebugPassManager);
-
- // FIXME: the backends do not handle matrix intrinsics currently. Make
- // sure they are also lowered in O0. A lightweight version of the pass
- // should run in the backend pipeline on demand.
- if (LangOpts.MatrixTypes)
- MPM.addPass(
- createModuleToFunctionPassAdaptor(LowerMatrixIntrinsicsPass()));
-
- addCoroutinePassesAtO0(MPM, LangOpts, CodeGenOpts);
+ MPM = PB.buildO0DefaultPipeline(Level, IsLTO || IsThinLTO);
} else if (IsThinLTO) {
MPM = PB.buildThinLTOPreLinkDefaultPipeline(Level);
} else if (IsLTO) {
@@ -1359,12 +1312,6 @@ void EmitAssemblyHelper::EmitAssemblyWithNewPassManager(
MPM = PB.buildPerModuleDefaultPipeline(Level);
}
- // Lastly, add semantically necessary passes for LTO.
- if (IsLTO || IsThinLTO) {
- MPM.addPass(CanonicalizeAliasesPass());
- MPM.addPass(NameAnonGlobalPass());
- }
-
// Add UniqueInternalLinkageNames Pass which renames internal linkage
// symbols with unique names.
if (CodeGenOpts.UniqueInternalLinkageNames)
diff --git a/llvm/include/llvm/Passes/PassBuilder.h b/llvm/include/llvm/Passes/PassBuilder.h
index 98af21b6276d..97e0b19ed07f 100644
--- a/llvm/include/llvm/Passes/PassBuilder.h
+++ b/llvm/include/llvm/Passes/PassBuilder.h
@@ -433,6 +433,12 @@ class PassBuilder {
ModulePassManager buildLTODefaultPipeline(OptimizationLevel Level,
ModuleSummaryIndex *ExportSummary);
+ /// Build an O0 pipeline with the minimal semantically required passes.
+ ///
+ /// This should only be used for non-LTO and LTO pre-link pipelines.
+ ModulePassManager buildO0DefaultPipeline(OptimizationLevel Level,
+ bool LTOPreLink = false);
+
/// Build the default `AAManager` with the default alias analysis pipeline
/// registered.
AAManager buildDefaultAAPipeline();
@@ -600,14 +606,6 @@ class PassBuilder {
OptimizerLastEPCallbacks.push_back(C);
}
- /// Run all registered extension point callbacks
- ///
- /// This runs the registered callbacks in the order they would be run in a
- /// typical build*Pipeline(). This allows for reusing register*EPCallback()
- /// between O0 and O[123] pipelines.
- void runRegisteredEPCallbacks(ModulePassManager &MPM, OptimizationLevel Level,
- bool DebugLogging);
-
/// Register a callback for parsing an AliasAnalysis Name to populate
/// the given AAManager \p AA
void registerParseAACallback(
@@ -688,6 +686,8 @@ class PassBuilder {
buildO1FunctionSimplificationPipeline(OptimizationLevel Level,
ThinLTOPhase Phase);
+ void addRequiredLTOPreLinkPasses(ModulePassManager &MPM);
+
static Optional<std::vector<PipelineElement>>
parsePipelineText(StringRef Text);
diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp
index 0af920eeee74..7df9efb002a0 100644
--- a/llvm/lib/Passes/PassBuilder.cpp
+++ b/llvm/lib/Passes/PassBuilder.cpp
@@ -806,6 +806,11 @@ PassBuilder::buildFunctionSimplificationPipeline(OptimizationLevel Level,
return FPM;
}
+void PassBuilder::addRequiredLTOPreLinkPasses(ModulePassManager &MPM) {
+ MPM.addPass(CanonicalizeAliasesPass());
+ MPM.addPass(NameAnonGlobalPass());
+}
+
void PassBuilder::addPGOInstrPasses(ModulePassManager &MPM,
PassBuilder::OptimizationLevel Level,
bool RunProfileGen, bool IsCS,
@@ -1349,6 +1354,9 @@ PassBuilder::buildPerModuleDefaultPipeline(OptimizationLevel Level,
// Emit annotation remarks.
addAnnotationRemarksPass(MPM);
+ if (LTOPreLink)
+ addRequiredLTOPreLinkPasses(MPM);
+
return MPM;
}
@@ -1399,6 +1407,8 @@ PassBuilder::buildThinLTOPreLinkDefaultPipeline(OptimizationLevel Level) {
// Emit annotation remarks.
addAnnotationRemarksPass(MPM);
+ addRequiredLTOPreLinkPasses(MPM);
+
return MPM;
}
@@ -1703,13 +1713,35 @@ PassBuilder::buildLTODefaultPipeline(OptimizationLevel Level,
return MPM;
}
-void PassBuilder::runRegisteredEPCallbacks(ModulePassManager &MPM,
- OptimizationLevel Level,
- bool DebugLogging) {
+ModulePassManager PassBuilder::buildO0DefaultPipeline(OptimizationLevel Level,
+ bool LTOPreLink) {
assert(Level == OptimizationLevel::O0 &&
- "runRegisteredEPCallbacks should only be used with O0");
+ "buildO0DefaultPipeline should only be used with O0");
+
+ ModulePassManager MPM(DebugLogging);
+
+ if (PGOOpt && (PGOOpt->Action == PGOOptions::IRInstr ||
+ PGOOpt->Action == PGOOptions::IRUse))
+ addPGOInstrPassesForO0(
+ MPM,
+ /* RunProfileGen */ (PGOOpt->Action == PGOOptions::IRInstr),
+ /* IsCS */ false, PGOOpt->ProfileFile, PGOOpt->ProfileRemappingFile);
+
for (auto &C : PipelineStartEPCallbacks)
C(MPM, Level);
+
+ // Build a minimal pipeline based on the semantics required by LLVM,
+ // which is just that always inlining occurs. Further, disable generating
+ // lifetime intrinsics to avoid enabling further optimizations during
+ // code generation.
+ // However, we need to insert lifetime intrinsics to avoid invalid access
+ // caused by multithreaded coroutines.
+ MPM.addPass(AlwaysInlinerPass(
+ /*InsertLifetimeIntrinsics=*/PTO.Coroutines));
+
+ if (EnableMatrix)
+ MPM.addPass(createModuleToFunctionPassAdaptor(LowerMatrixIntrinsicsPass()));
+
if (!LateLoopOptimizationsEPCallbacks.empty()) {
LoopPassManager LPM(DebugLogging);
for (auto &C : LateLoopOptimizationsEPCallbacks)
@@ -1749,8 +1781,25 @@ void PassBuilder::runRegisteredEPCallbacks(ModulePassManager &MPM,
if (!FPM.isEmpty())
MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
}
+
+ if (PTO.Coroutines) {
+ MPM.addPass(createModuleToFunctionPassAdaptor(CoroEarlyPass()));
+
+ CGSCCPassManager CGPM(DebugLogging);
+ CGPM.addPass(CoroSplitPass());
+ CGPM.addPass(createCGSCCToFunctionPassAdaptor(CoroElidePass()));
+ MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(std::move(CGPM)));
+
+ MPM.addPass(createModuleToFunctionPassAdaptor(CoroCleanupPass()));
+ }
+
for (auto &C : OptimizerLastEPCallbacks)
C(MPM, Level);
+
+ if (LTOPreLink)
+ addRequiredLTOPreLinkPasses(MPM);
+
+ return MPM;
}
AAManager PassBuilder::buildDefaultAAPipeline() {
@@ -2311,33 +2360,10 @@ Error PassBuilder::parseModulePass(ModulePassManager &MPM,
.Case("O3", OptimizationLevel::O3)
.Case("Os", OptimizationLevel::Os)
.Case("Oz", OptimizationLevel::Oz);
- if (L == OptimizationLevel::O0) {
- // Add instrumentation PGO passes -- at O0 we can still do PGO.
- if (PGOOpt && Matches[1] != "thinlto" &&
- (PGOOpt->Action == PGOOptions::IRInstr ||
- PGOOpt->Action == PGOOptions::IRUse))
- addPGOInstrPassesForO0(
- MPM,
- /* RunProfileGen */ (PGOOpt->Action == PGOOptions::IRInstr),
- /* IsCS */ false, PGOOpt->ProfileFile,
- PGOOpt->ProfileRemappingFile);
-
- // For IR that makes use of coroutines intrinsics, coroutine passes must
- // be run, even at -O0.
- if (PTO.Coroutines) {
- MPM.addPass(createModuleToFunctionPassAdaptor(CoroEarlyPass()));
-
- CGSCCPassManager CGPM(DebugLogging);
- CGPM.addPass(CoroSplitPass());
- CGPM.addPass(createCGSCCToFunctionPassAdaptor(CoroElidePass()));
- MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(std::move(CGPM)));
-
- MPM.addPass(createModuleToFunctionPassAdaptor(CoroCleanupPass()));
- }
-
- runRegisteredEPCallbacks(MPM, L, DebugLogging);
-
- // Do nothing else at all!
+ if (L == OptimizationLevel::O0 && Matches[1] != "thinlto" &&
+ Matches[1] != "lto") {
+ MPM.addPass(buildO0DefaultPipeline(L, Matches[1] == "thinlto-pre-link" ||
+ Matches[1] == "lto-pre-link"));
return Error::success();
}
diff --git a/llvm/test/Other/new-pass-manager.ll b/llvm/test/Other/new-pass-manager.ll
index 877eb941dbdd..1206f2c4b5dc 100644
--- a/llvm/test/Other/new-pass-manager.ll
+++ b/llvm/test/Other/new-pass-manager.ll
@@ -360,7 +360,9 @@
; RUN: -passes='default<O0>' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-O0 --check-prefix=%llvmcheckext
; CHECK-O0: Starting llvm::Module pass manager run
-; CHECK-EXT-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}>
+; CHECK-O0-NEXT: Running pass: AlwaysInlinerPass
+; CHECK-O0-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}>
+; CHECK-O0-NEXT: Running analysis: ProfileSummaryAnalysis
; CHECK-EXT-NEXT: Starting llvm::Function pass manager run.
; CHECK-EXT-NEXT: Running pass: {{.*}}Bye
; CHECK-EXT-NEXT: Finished llvm::Function pass manager run.
diff --git a/llvm/test/Other/new-pm-O0-defaults.ll b/llvm/test/Other/new-pm-O0-defaults.ll
new file mode 100644
index 000000000000..2e4d5a478431
--- /dev/null
+++ b/llvm/test/Other/new-pm-O0-defaults.ll
@@ -0,0 +1,70 @@
+; The IR below was crafted so as:
+; 1) To have a loop, so we create a loop pass manager
+; 2) To be "immutable" in the sense that no pass in the standard
+; pipeline will modify it.
+; Since no transformations take place, we don't expect any analyses
+; to be invalidated.
+; 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: -passes='default<O0>' -S %s 2>&1 \
+; RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-DEFAULT
+; RUN: opt -disable-verify -debug-pass-manager \
+; RUN: -passes='thinlto-pre-link<O0>' -S %s 2>&1 \
+; RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-DEFAULT,CHECK-PRE-LINK
+; RUN: opt -disable-verify -debug-pass-manager \
+; RUN: -passes='lto-pre-link<O0>' -S %s 2>&1 \
+; RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-DEFAULT,CHECK-PRE-LINK
+; RUN: opt -disable-verify -debug-pass-manager \
+; RUN: -passes='thinlto<O0>' -S %s 2>&1 \
+; RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-THINLTO
+; RUN: opt -disable-verify -debug-pass-manager \
+; RUN: -passes='lto<O0>' -S %s 2>&1 \
+; RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-LTO
+
+; CHECK: Starting llvm::Module pass manager run.
+; CHECK-DEFAULT-NEXT: Running pass: AlwaysInlinerPass
+; CHECK-DEFAULT-NEXT: Running analysis: InnerAnalysisManagerProxy
+; CHECK-DEFAULT-NEXT: Running analysis: ProfileSummaryAnalysis
+; CHECK-PRE-LINK-NEXT: Running pass: CanonicalizeAliasesPass
+; CHECK-PRE-LINK-NEXT: Running pass: NameAnonGlobalPass
+; CHECK-THINLTO-NEXT: Running pass: Annotation2MetadataPass
+; CHECK-LTO-NEXT: Running pass: Annotation2MetadataPass
+; CHECK-LTO-NEXT: Running pass: WholeProgramDevirtPass
+; CHECK-LTO-NEXT: Running analysis: InnerAnalysisManagerProxy
+; CHECK-LTO-NEXT: Running pass: LowerTypeTestsPass
+; CHECK-LTO-NEXT: Running pass: LowerTypeTestsPass
+; CHECK-LTO-NEXT: Running pass: AnnotationRemarksPass
+; CHECK-NEXT: Running pass: PrintModulePass
+
+; Make sure we get the IR back out without changes when we print the module.
+; CHECK-LABEL: define void @foo(i32 %n) local_unnamed_addr {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: br label %loop
+; CHECK: loop:
+; CHECK-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
+; CHECK-NEXT: %iv.next = add i32 %iv, 1
+; CHECK-NEXT: tail call void @bar()
+; CHECK-NEXT: %cmp = icmp eq i32 %iv, %n
+; CHECK-NEXT: br i1 %cmp, label %exit, label %loop
+; CHECK: exit:
+; CHECK-NEXT: ret void
+; CHECK-NEXT: }
+;
+; CHECK-NEXT: Finished llvm::Module pass manager run.
+
+declare void @bar() local_unnamed_addr
+
+define void @foo(i32 %n) local_unnamed_addr {
+entry:
+ br label %loop
+loop:
+ %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
+ %iv.next = add i32 %iv, 1
+ tail call void @bar()
+ %cmp = icmp eq i32 %iv, %n
+ br i1 %cmp, label %exit, label %loop
+exit:
+ ret void
+}
diff --git a/llvm/test/Other/new-pm-defaults.ll b/llvm/test/Other/new-pm-defaults.ll
index 5b24a4ccd597..1f2142c5bcd1 100644
--- a/llvm/test/Other/new-pm-defaults.ll
+++ b/llvm/test/Other/new-pm-defaults.ll
@@ -9,84 +9,59 @@
; RUN: opt -disable-verify -debug-pass-manager \
; RUN: -passes='default<O1>' -S %s 2>&1 \
-; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O1 \
-; RUN: --check-prefix=%llvmcheckext
+; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-DEFAULT,CHECK-O1,%llvmcheckext
; RUN: opt -disable-verify -debug-pass-manager \
; RUN: -passes='default<O2>' -S %s 2>&1 \
-; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O2 \
-; RUN: --check-prefix=CHECK-O23SZ --check-prefix=%llvmcheckext
+; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-DEFAULT,CHECK-O2,CHECK-O23SZ,%llvmcheckext
; RUN: opt -disable-verify -debug-pass-manager \
; RUN: -passes='default<O3>' -S %s 2>&1 \
-; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O3 \
-; RUN: --check-prefix=CHECK-O23SZ --check-prefix=%llvmcheckext
+; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-DEFAULT,CHECK-O3,CHECK-O23SZ,%llvmcheckext
; RUN: opt -disable-verify -debug-pass-manager \
; RUN: -passes='default<Os>' -S %s 2>&1 \
-; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-Os \
-; RUN: --check-prefix=CHECK-O23SZ --check-prefix=%llvmcheckext
+; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-DEFAULT,CHECK-Os,CHECK-O23SZ,%llvmcheckext
; RUN: opt -disable-verify -debug-pass-manager \
; RUN: -passes='default<Oz>' -S %s 2>&1 \
-; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-Oz \
-; RUN: --check-prefix=CHECK-O23SZ --check-prefix=%llvmcheckext
+; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-DEFAULT,CHECK-Oz,CHECK-O23SZ,%llvmcheckext
; RUN: opt -disable-verify -debug-pass-manager \
; RUN: -passes='lto-pre-link<O2>' -S %s 2>&1 \
-; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O2 \
-; RUN: --check-prefix=CHECK-O23SZ --check-prefix=%llvmcheckext \
-; RUN: --check-prefix=CHECK-O2-LTO
+; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-LTO,CHECK-O2,CHECK-O23SZ,%llvmcheckext
; RUN: opt -disable-verify -debug-pass-manager \
; RUN: -passes-ep-peephole='no-op-function' \
; RUN: -passes='default<O3>' -S %s 2>&1 \
-; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O3 \
-; RUN: --check-prefix=%llvmcheckext \
-; RUN: --check-prefix=CHECK-EP-PEEPHOLE --check-prefix=CHECK-O23SZ
+; 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: -passes-ep-late-loop-optimizations='no-op-loop' \
; RUN: -passes='default<O3>' -S %s 2>&1 \
-; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O3 \
-; RUN: --check-prefix=%llvmcheckext \
-; RUN: --check-prefix=CHECK-EP-LOOP-LATE --check-prefix=CHECK-O23SZ
+; 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: -passes-ep-loop-optimizer-end='no-op-loop' \
; RUN: -passes='default<O3>' -S %s 2>&1 \
-; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O3 \
-; RUN: --check-prefix=%llvmcheckext \
-; RUN: --check-prefix=CHECK-EP-LOOP-END --check-prefix=CHECK-O23SZ
+; 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: -passes-ep-scalar-optimizer-late='no-op-function' \
; RUN: -passes='default<O3>' -S %s 2>&1 \
-; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O3 \
-; RUN: --check-prefix=%llvmcheckext \
-; RUN: --check-prefix=CHECK-EP-SCALAR-LATE --check-prefix=CHECK-O23SZ
+; 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: -passes-ep-cgscc-optimizer-late='no-op-cgscc' \
; RUN: -passes='default<O3>' -S %s 2>&1 \
-; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O3 \
-; RUN: --check-prefix=%llvmcheckext \
-; RUN: --check-prefix=CHECK-EP-CGSCC-LATE --check-prefix=CHECK-O23SZ
+; 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: -passes-ep-vectorizer-start='no-op-function' \
; RUN: -passes='default<O3>' -S %s 2>&1 \
-; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O3 \
-; RUN: --check-prefix=%llvmcheckext \
-; RUN: --check-prefix=CHECK-EP-VECTORIZER-START --check-prefix=CHECK-O23SZ
+; 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: -passes-ep-pipeline-start='no-op-module' \
; RUN: -passes='default<O3>' -S %s 2>&1 \
-; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O3 \
-; RUN: --check-prefix=%llvmcheckext \
-; RUN: --check-prefix=CHECK-EP-PIPELINE-START --check-prefix=CHECK-O23SZ
+; 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: -passes-ep-pipeline-start='no-op-module' \
; RUN: -passes='lto-pre-link<O3>' -S %s 2>&1 \
-; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O3 \
-; RUN: --check-prefix=%llvmcheckext \
-; RUN: --check-prefix=CHECK-EP-PIPELINE-START --check-prefix=CHECK-O23SZ
+; 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: -passes-ep-optimizer-last='no-op-function' \
; RUN: -passes='default<O3>' -S %s 2>&1 \
-; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O3 \
-; RUN: --check-prefix=%llvmcheckext \
-; RUN: --check-prefix=CHECK-EP-OPTIMIZER-LAST --check-prefix=CHECK-O23SZ
+; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-DEFAULT,CHECK-O3,%llvmcheckext,CHECK-EP-OPTIMIZER-LAST,CHECK-O23SZ
; Suppress FileCheck --allow-unused-prefixes=false diagnostics.
; CHECK-Oz: {{^}}
@@ -225,8 +200,9 @@
; CHECK-O-NEXT: Finished llvm::Module pass manager run.
; CHECK-O-NEXT: Running pass: GlobalOptPass
; CHECK-O-NEXT: Running pass: GlobalDCEPass
-; CHECK-O2-LTO-NOT: Running pass: EliminateAvailableExternallyPass
-; CHECK-O: Running pass: ReversePostOrderFunctionAttrsPass
+; CHECK-DEFAULT-NEXT: Running pass: EliminateAvailableExternallyPass
+; CHECK-LTO-NOT: Running pass: EliminateAvailableExternallyPass
+; CHECK-O-NEXT: Running pass: ReversePostOrderFunctionAttrsPass
; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}GlobalsAA
; CHECK-O-NEXT: Starting llvm::Function pass manager run.
; CHECK-O-NEXT: Running pass: Float2IntPass
@@ -274,6 +250,8 @@
; CHECK-O-NEXT: Running pass: GlobalDCEPass
; CHECK-O-NEXT: Running pass: ConstantMergePass
; CHECK-O-NEXT: Running pass: AnnotationRemarksPass on foo
+; CHECK-LTO-NEXT: Running pass: CanonicalizeAliasesPass
+; CHECK-LTO-NEXT: Running pass: NameAnonGlobalPass
; CHECK-O-NEXT: Running pass: PrintModulePass
;
; Make sure we get the IR back out without changes when we print the module.
diff --git a/llvm/test/Other/new-pm-pgo-O0.ll b/llvm/test/Other/new-pm-pgo-O0.ll
index 6a6da67bb120..d7a6a03b8e44 100644
--- a/llvm/test/Other/new-pm-pgo-O0.ll
+++ b/llvm/test/Other/new-pm-pgo-O0.ll
@@ -7,6 +7,8 @@
; RUN: |FileCheck %s --check-prefixes=USE_PRE_LINK,USE
; RUN: opt -debug-pass-manager -passes='thinlto<O0>' -pgo-kind=pgo-instr-use-pipeline -profile-file='%t.profdata' %s 2>&1 \
; RUN: |FileCheck %s --check-prefixes=USE_POST_LINK,USE
+; RUN: opt -debug-pass-manager -passes='lto<O0>' -pgo-kind=pgo-instr-use-pipeline -profile-file='%t.profdata' %s 2>&1 \
+; RUN: |FileCheck %s --check-prefixes=USE_POST_LINK,USE
;
; GEN: Running pass: PGOInstrumentationGen
diff --git a/llvm/test/Other/new-pm-thinlto-defaults.ll b/llvm/test/Other/new-pm-thinlto-defaults.ll
index 9d33e8f8235d..675047421503 100644
--- a/llvm/test/Other/new-pm-thinlto-defaults.ll
+++ b/llvm/test/Other/new-pm-thinlto-defaults.ll
@@ -9,22 +9,22 @@
;
; Prelink pipelines:
; RUN: opt -disable-verify -debug-pass-manager \
-; RUN: -passes='thinlto-pre-link<O1>,name-anon-globals' -S %s 2>&1 \
+; RUN: -passes='thinlto-pre-link<O1>' -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: -passes='thinlto-pre-link<O2>,name-anon-globals' -S %s 2>&1 \
+; RUN: -passes='thinlto-pre-link<O2>' -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: -passes='thinlto-pre-link<O3>,name-anon-globals' -S -passes-ep-pipeline-start='no-op-module' %s 2>&1 \
+; RUN: -passes='thinlto-pre-link<O3>' -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: -passes='thinlto-pre-link<Os>,name-anon-globals' -S %s 2>&1 \
+; RUN: -passes='thinlto-pre-link<Os>' -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: -passes='thinlto-pre-link<Oz>,name-anon-globals' -S %s 2>&1 \
+; RUN: -passes='thinlto-pre-link<Oz>' -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: -passes='thinlto-pre-link<O2>,name-anon-globals' -S %s 2>&1 \
+; RUN: -passes='thinlto-pre-link<O2>' -S %s 2>&1 \
; RUN: | FileCheck %s --check-prefixes=CHECK-DIS,CHECK-O,CHECK-O2,CHECK-O23SZ,CHECK-PRELINK-O
;
; Postlink pipelines:
@@ -242,6 +242,7 @@
; CHECK-POSTLINK-O-NEXT: Running pass: GlobalDCEPass
; CHECK-POSTLINK-O-NEXT: Running pass: ConstantMergePass
; CHECK-O-NEXT: Running pass: AnnotationRemarksPass on foo
+; CHECK-PRELINK-O-NEXT: Running pass: CanonicalizeAliasesPass
; CHECK-PRELINK-O-NEXT: Running pass: NameAnonGlobalPass
; CHECK-O-NEXT: Running pass: PrintModulePass
diff --git a/llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll b/llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
index 211282d16a5c..a420062390d0 100644
--- a/llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
+++ b/llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
@@ -4,27 +4,27 @@
;
; RUN: opt -disable-verify -debug-pass-manager \
; RUN: -pgo-kind=pgo-instr-use-pipeline -profile-file='%t.profdata' \
-; RUN: -passes='thinlto-pre-link<O1>,name-anon-globals' -S %s 2>&1 \
+; RUN: -passes='thinlto-pre-link<O1>' -S %s 2>&1 \
; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O1,CHECK-O123
; RUN: opt -disable-verify -debug-pass-manager \
; RUN: -pgo-kind=pgo-instr-use-pipeline -profile-file='%t.profdata' \
-; RUN: -passes='thinlto-pre-link<O2>,name-anon-globals' -S %s 2>&1 \
+; RUN: -passes='thinlto-pre-link<O2>' -S %s 2>&1 \
; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O2,CHECK-O23SZ,CHECK-O123
; RUN: opt -disable-verify -debug-pass-manager \
; RUN: -pgo-kind=pgo-instr-use-pipeline -profile-file='%t.profdata' \
-; RUN: -passes='thinlto-pre-link<O3>,name-anon-globals' -S -passes-ep-pipeline-start='no-op-module' %s 2>&1 \
+; RUN: -passes='thinlto-pre-link<O3>' -S -passes-ep-pipeline-start='no-op-module' %s 2>&1 \
; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O3,CHECK-O23SZ,CHECK-O123,CHECK-EP-PIPELINE-START
; RUN: opt -disable-verify -debug-pass-manager \
; RUN: -pgo-kind=pgo-instr-use-pipeline -profile-file='%t.profdata' \
-; RUN: -passes='thinlto-pre-link<Os>,name-anon-globals' -S %s 2>&1 \
+; RUN: -passes='thinlto-pre-link<Os>' -S %s 2>&1 \
; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-Os,CHECK-O23SZ
; RUN: opt -disable-verify -debug-pass-manager \
; RUN: -pgo-kind=pgo-instr-use-pipeline -profile-file='%t.profdata' \
-; RUN: -passes='thinlto-pre-link<Oz>,name-anon-globals' -S %s 2>&1 \
+; RUN: -passes='thinlto-pre-link<Oz>' -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: -pgo-kind=pgo-instr-use-pipeline -profile-file='%t.profdata' \
-; RUN: -passes='thinlto-pre-link<O2>,name-anon-globals' -S %s 2>&1 \
+; RUN: -passes='thinlto-pre-link<O2>' -S %s 2>&1 \
; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O2,CHECK-O23SZ,CHECK-O123
;
; CHECK-O: Starting {{.*}}Module pass manager run.
@@ -220,6 +220,7 @@
; CHECK-O-NEXT: Running analysis: TargetLibraryAnalysis on bar
; CHECK-EXT: Running pass: {{.*}}::Bye
; CHECK-O-NEXT: Running pass: AnnotationRemarksPass on foo
+; CHECK-O-NEXT: Running pass: CanonicalizeAliasesPass
; CHECK-O-NEXT: Running pass: NameAnonGlobalPass
; CHECK-O-NEXT: Running pass: PrintModulePass
diff --git a/llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll b/llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
index c3078f6d4ddd..57e1cd926948 100644
--- a/llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
+++ b/llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
@@ -2,27 +2,27 @@
;
; RUN: opt -disable-verify -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<O1>,name-anon-globals' -S %s 2>&1 \
+; RUN: -passes='thinlto-pre-link<O1>' -S %s 2>&1 \
; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O1
; RUN: opt -disable-verify -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<O2>,name-anon-globals' -S %s 2>&1 \
+; RUN: -passes='thinlto-pre-link<O2>' -S %s 2>&1 \
; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O2,CHECK-O23SZ
; RUN: opt -disable-verify -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<O3>,name-anon-globals' -S -passes-ep-pipeline-start='no-op-module' %s 2>&1 \
+; RUN: -passes='thinlto-pre-link<O3>' -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: -pgo-kind=pgo-sample-use-pipeline -profile-file='%S/Inputs/new-pm-thinlto-samplepgo-defaults.prof' \
-; RUN: -passes='thinlto-pre-link<Os>,name-anon-globals' -S %s 2>&1 \
+; RUN: -passes='thinlto-pre-link<Os>' -S %s 2>&1 \
; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-Os,CHECK-O23SZ
; RUN: opt -disable-verify -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<Oz>,name-anon-globals' -S %s 2>&1 \
+; RUN: -passes='thinlto-pre-link<Oz>' -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: -pgo-kind=pgo-sample-use-pipeline -profile-file='%S/Inputs/new-pm-thinlto-samplepgo-defaults.prof' \
-; RUN: -passes='thinlto-pre-link<O2>,name-anon-globals' -S %s 2>&1 \
+; RUN: -passes='thinlto-pre-link<O2>' -S %s 2>&1 \
; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O2,CHECK-O23SZ
;
; CHECK-O: Starting {{.*}}Module pass manager run.
@@ -173,6 +173,7 @@
; CHECK-O-NEXT: Finished {{.*}}Module pass manager run.
; CHECK-O-NEXT: Running pass: GlobalOptPass
; CHECK-O-NEXT: Running pass: AnnotationRemarksPass on foo
+; CHECK-O-NEXT: Running pass: CanonicalizeAliasesPass
; CHECK-O-NEXT: Running pass: NameAnonGlobalPass
; CHECK-O-NEXT: Running pass: PrintModulePass
diff --git a/llvm/test/Transforms/CanonicalizeAliases/canonicalize.ll b/llvm/test/Transforms/CanonicalizeAliases/canonicalize.ll
index e762fc55953e..5c3e1b339e21 100644
--- a/llvm/test/Transforms/CanonicalizeAliases/canonicalize.ll
+++ b/llvm/test/Transforms/CanonicalizeAliases/canonicalize.ll
@@ -1,6 +1,7 @@
; RUN: opt -S -canonicalize-aliases < %s | FileCheck %s
-; RUN: opt -prepare-for-thinlto -O0 -module-summary -o - < %s | llvm-dis -o - | FileCheck %s
; RUN: opt -S -passes=canonicalize-aliases < %s | FileCheck %s
+; RUN: opt -prepare-for-thinlto -O0 -module-summary -o - < %s -enable-new-pm=0 | llvm-dis -o - | FileCheck %s
+; RUN: opt -passes='thinlto-pre-link<O0>,require<module-summary>' -o - < %s | llvm-dis -o - | FileCheck %s
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
diff --git a/llvm/test/Transforms/NameAnonGlobals/rename.ll b/llvm/test/Transforms/NameAnonGlobals/rename.ll
index 74fb972e7561..61988d94bdbd 100644
--- a/llvm/test/Transforms/NameAnonGlobals/rename.ll
+++ b/llvm/test/Transforms/NameAnonGlobals/rename.ll
@@ -1,5 +1,6 @@
; RUN: opt -S -name-anon-globals < %s | FileCheck %s
-; RUN: opt -prepare-for-thinlto -O0 -module-summary -o %t.bc < %s
+; RUN: opt -prepare-for-thinlto -O0 -module-summary -o %t.bc -enable-new-pm=0 < %s
+; RUN: opt -passes='thinlto-pre-link<O0>,require<module-summary>' -o %t.bc < %s
; foo contribute to the unique hash for the module
More information about the llvm-commits
mailing list