-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Revert "[LTO][Pipelines][Coro] De-duplicate Coro passes" #129977
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
vitalybuka
merged 1 commit into
main
from
revert-128654-users/vitalybuka/spr/ltopipelinescoro-de-duplicate-coro-passes
Mar 6, 2025
Merged
Revert "[LTO][Pipelines][Coro] De-duplicate Coro passes" #129977
vitalybuka
merged 1 commit into
main
from
revert-128654-users/vitalybuka/spr/ltopipelinescoro-de-duplicate-coro-passes
Mar 6, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This reverts commit 31897e6.
@llvm/pr-subscribers-lto Author: Vitaly Buka (vitalybuka) ChangesReverts llvm/llvm-project#128654 Breaks FatLTO #128654 (comment) Full diff: https://github.com/llvm/llvm-project/pull/129977.diff 4 Files Affected:
diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp
index 546a5eb1ec283..07db107325f02 100644
--- a/llvm/lib/Passes/PassBuilderPipelines.cpp
+++ b/llvm/lib/Passes/PassBuilderPipelines.cpp
@@ -419,16 +419,14 @@ static bool isLTOPostLink(ThinOrFullLTOPhase Phase) {
// Helper to wrap conditionally Coro passes.
static CoroConditionalWrapper buildCoroWrapper(ThinOrFullLTOPhase Phase) {
+ // TODO: Skip passes according to Phase.
ModulePassManager CoroPM;
- if (!isLTOPostLink(Phase))
- CoroPM.addPass(CoroEarlyPass());
- if (!isLTOPreLink(Phase)) {
- CGSCCPassManager CGPM;
- CGPM.addPass(CoroSplitPass());
- CoroPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(std::move(CGPM)));
- CoroPM.addPass(CoroCleanupPass());
- CoroPM.addPass(GlobalDCEPass());
- }
+ CoroPM.addPass(CoroEarlyPass());
+ CGSCCPassManager CGPM;
+ CGPM.addPass(CoroSplitPass());
+ CoroPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(std::move(CGPM)));
+ CoroPM.addPass(CoroCleanupPass());
+ CoroPM.addPass(GlobalDCEPass());
return CoroConditionalWrapper(std::move(CoroPM));
}
@@ -1012,7 +1010,7 @@ PassBuilder::buildInlinerPipeline(OptimizationLevel Level,
MainCGPipeline.addPass(createCGSCCToFunctionPassAdaptor(
RequireAnalysisPass<ShouldNotRunFunctionPassesAnalysis, Function>()));
- if (!isLTOPreLink(Phase)) {
+ if (Phase != ThinOrFullLTOPhase::ThinLTOPreLink) {
MainCGPipeline.addPass(CoroSplitPass(Level != OptimizationLevel::O0));
MainCGPipeline.addPass(CoroAnnotationElidePass());
}
@@ -1062,7 +1060,7 @@ PassBuilder::buildModuleInlinerPipeline(OptimizationLevel Level,
buildFunctionSimplificationPipeline(Level, Phase),
PTO.EagerlyInvalidateAnalyses));
- if (!isLTOPreLink(Phase)) {
+ if (Phase != ThinOrFullLTOPhase::ThinLTOPreLink) {
MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(
CoroSplitPass(Level != OptimizationLevel::O0)));
MPM.addPass(
@@ -1122,8 +1120,7 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level,
// Do basic inference of function attributes from known properties of system
// libraries and other oracles.
MPM.addPass(InferFunctionAttrsPass());
- if (!isLTOPostLink(Phase))
- MPM.addPass(CoroEarlyPass());
+ MPM.addPass(CoroEarlyPass());
FunctionPassManager EarlyFPM;
EarlyFPM.addPass(EntryExitInstrumenterPass(/*PostInlining=*/false));
@@ -1293,7 +1290,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.
@@ -1958,6 +1955,9 @@ PassBuilder::buildLTODefaultPipeline(OptimizationLevel Level,
return MPM;
}
+ // TODO: Skip to match buildCoroWrapper.
+ MPM.addPass(CoroEarlyPass());
+
// Optimize globals to try and fold them into constants.
MPM.addPass(GlobalOptPass());
diff --git a/llvm/test/LTO/X86/coro.ll b/llvm/test/LTO/X86/coro.ll
index f9830d964bc69..cde398dd76d85 100644
--- a/llvm/test/LTO/X86/coro.ll
+++ b/llvm/test/LTO/X86/coro.ll
@@ -1,6 +1,4 @@
-; RUN: opt %s -passes='lto-pre-link<O0>' -S -o %t1.ll
-; RUN: FileCheck %s --check-prefixes=CHECK,PRELINK --implicit-check-not="call void @llvm.coro" --input-file=%t1.ll
-; RUN: llvm-as %t1.ll -o %t1.bc
+; RUN: llvm-as %s -o %t1.bc
; RUN: llvm-lto2 run %t1.bc -o %t2.o -r=%t1.bc,test,plx -r=%t1.bc,extern_func,plx -save-temps
; RUN: llvm-dis %t2.o.0.5.precodegen.bc -o - | FileCheck %s --implicit-check-not="call void @llvm.coro"
@@ -9,9 +7,7 @@ target triple = "x86_64-unknown-fuchsia"
declare void @extern_func()
-; CHECK: define{{.*}} void @test(
-; PRELINK: call ptr @llvm.coro.subfn.addr
-; PRELINK: call ptr @llvm.coro.subfn.addr
+; CHECK: define {{.*}} void @test(
define void @test(ptr %hdl) {
call void @llvm.coro.resume(ptr %hdl)
call void @llvm.coro.destroy(ptr %hdl)
diff --git a/llvm/test/Other/new-pm-defaults.ll b/llvm/test/Other/new-pm-defaults.ll
index 30ff1a5879df2..c554fdbf4c799 100644
--- a/llvm/test/Other/new-pm-defaults.ll
+++ b/llvm/test/Other/new-pm-defaults.ll
@@ -230,13 +230,13 @@
; 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-DEFAULT-NEXT: Running pass: CoroAnnotationElidePass
+; CHECK-O-NEXT: Running pass: CoroSplitPass
+; CHECK-O-NEXT: Running pass: CoroAnnotationElidePass
; 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-O-NEXT: Running pass: CoroCleanupPass
; CHECK-O-NEXT: Running pass: GlobalOptPass
; CHECK-O-NEXT: Running pass: GlobalDCEPass
; CHECK-DEFAULT-NEXT: Running pass: EliminateAvailableExternallyPass
diff --git a/llvm/test/Other/new-pm-lto-defaults.ll b/llvm/test/Other/new-pm-lto-defaults.ll
index e4320bb619533..3aea0f2061f3e 100644
--- a/llvm/test/Other/new-pm-lto-defaults.ll
+++ b/llvm/test/Other/new-pm-lto-defaults.ll
@@ -67,6 +67,7 @@
; CHECK-O1-NEXT: Running analysis: TargetLibraryAnalysis
; CHECK-O-NEXT: Running pass: GlobalSplitPass
; CHECK-O-NEXT: Running pass: WholeProgramDevirtPass
+; CHECK-O23SZ-NEXT: Running pass: CoroEarlyPass
; CHECK-O1-NEXT: Running pass: LowerTypeTestsPass
; CHECK-O23SZ-NEXT: Running pass: GlobalOptPass
; CHECK-O23SZ-NEXT: Running pass: PromotePass
|
thevinster
approved these changes
Mar 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
jph-13
pushed a commit
to jph-13/llvm-project
that referenced
this pull request
Mar 21, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
LTO
Link time optimization (regular/full LTO or ThinLTO)
skip-precommit-approval
PR for CI feedback, not intended for review
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reverts #128654
Breaks FatLTO #128654 (comment)