[clang] [llvm] [Pipelines][Coroutines] Tune coroutine passes only for ThinLTO pre-link pipeline (PR #90690)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 30 16:53:58 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-coroutines
@llvm/pr-subscribers-clang
Author: Wei Wang (apolloww)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/90690.diff
3 Files Affected:
- (modified) clang/test/CodeGenCoroutines/coro-elide-thinlto.cpp (+1)
- (modified) llvm/lib/Passes/PassBuilderPipelines.cpp (+3-3)
- (modified) llvm/test/Other/new-pm-defaults.ll (+2-4)
``````````diff
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
``````````
</details>
https://github.com/llvm/llvm-project/pull/90690
More information about the cfe-commits
mailing list