[clang] [llvm] [Pipelines][Coroutines] Tune coroutine passes only for ThinLTO pre-link pipeline (PR #90690)
Wei Wang via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 30 16:53:28 PDT 2024
https://github.com/apolloww created https://github.com/llvm/llvm-project/pull/90690
Follow up to #90310, limit the tune up only to ThinLTO pre-link as coroutine passes are not in MonoLTO backend
Also coro-elide-thinlto test is still failing on some Buildbots, only run the test under x86_64 linux target.
>From a47f8207a73f850acbc493f827a127c6aa52db77 Mon Sep 17 00:00:00 2001
From: Wei Wang <apollo.mobility at gmail.com>
Date: Tue, 30 Apr 2024 16:48:24 -0700
Subject: [PATCH] fix coro mono lto
---
clang/test/CodeGenCoroutines/coro-elide-thinlto.cpp | 1 +
llvm/lib/Passes/PassBuilderPipelines.cpp | 6 +++---
llvm/test/Other/new-pm-defaults.ll | 6 ++----
3 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/clang/test/CodeGenCoroutines/coro-elide-thinlto.cpp b/clang/test/CodeGenCoroutines/coro-elide-thinlto.cpp
index d0e60e67963dfd..5b2d0146578437 100644
--- a/clang/test/CodeGenCoroutines/coro-elide-thinlto.cpp
+++ b/clang/test/CodeGenCoroutines/coro-elide-thinlto.cpp
@@ -1,3 +1,4 @@
+// REQUIRES: x86_64-linux
// This tests that the coroutine elide optimization could happen succesfully with ThinLTO.
// This test is adapted from coro-elide.cpp and splits functions into two files.
//
diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp
index 594549034cc829..100889c0845bc3 100644
--- a/llvm/lib/Passes/PassBuilderPipelines.cpp
+++ b/llvm/lib/Passes/PassBuilderPipelines.cpp
@@ -963,7 +963,7 @@ PassBuilder::buildInlinerPipeline(OptimizationLevel Level,
MainCGPipeline.addPass(createCGSCCToFunctionPassAdaptor(
RequireAnalysisPass<ShouldNotRunFunctionPassesAnalysis, Function>()));
- if (!isLTOPreLink(Phase))
+ if (Phase != ThinOrFullLTOPhase::ThinLTOPreLink)
MainCGPipeline.addPass(CoroSplitPass(Level != OptimizationLevel::O0));
// Make sure we don't affect potential future NoRerun CGSCC adaptors.
@@ -1006,7 +1006,7 @@ PassBuilder::buildModuleInlinerPipeline(OptimizationLevel Level,
buildFunctionSimplificationPipeline(Level, Phase),
PTO.EagerlyInvalidateAnalyses));
- if (!isLTOPreLink(Phase))
+ if (Phase != ThinOrFullLTOPhase::ThinLTOPreLink)
MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(
CoroSplitPass(Level != OptimizationLevel::O0)));
@@ -1185,7 +1185,7 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level,
// and argument promotion.
MPM.addPass(DeadArgumentEliminationPass());
- if (!isLTOPreLink(Phase))
+ if (Phase != ThinOrFullLTOPhase::ThinLTOPreLink)
MPM.addPass(CoroCleanupPass());
// Optimize globals now that functions are fully simplified.
diff --git a/llvm/test/Other/new-pm-defaults.ll b/llvm/test/Other/new-pm-defaults.ll
index ebfed7b687e2ce..51fb93daa4dfa6 100644
--- a/llvm/test/Other/new-pm-defaults.ll
+++ b/llvm/test/Other/new-pm-defaults.ll
@@ -224,14 +224,12 @@
; CHECK-O-NEXT: Running pass: PostOrderFunctionAttrsPass
; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}ShouldNotRunFunctionPassesAnalysis
; CHECK-O-NEXT: Running analysis: ShouldNotRunFunctionPassesAnalysis
-; CHECK-DEFAULT-NEXT: Running pass: CoroSplitPass
-; CHECK-LTO-NOT: Running pass: CoroSplitPass
+; CHECK-O-NEXT: Running pass: CoroSplitPass
; CHECK-O-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}ShouldNotRunFunctionPassesAnalysis
; CHECK-O-NEXT: Invalidating analysis: ShouldNotRunFunctionPassesAnalysis
; CHECK-O-NEXT: Invalidating analysis: InlineAdvisorAnalysis
; CHECK-O-NEXT: Running pass: DeadArgumentEliminationPass
-; CHECK-DEFAULT-NEXT: Running pass: CoroCleanupPass
-; CHECK-LTO-NOT: Running pass: CoroCleanupPass
+; CHECK-O-NEXT: Running pass: CoroCleanupPass
; CHECK-O-NEXT: Running pass: GlobalOptPass
; CHECK-O-NEXT: Running pass: GlobalDCEPass
; CHECK-DEFAULT-NEXT: Running pass: EliminateAvailableExternallyPass
More information about the cfe-commits
mailing list