Skip to content

Commit 1d825ec

Browse files
vitalybukagithub-actions[bot]
authored andcommitted
Automerge: Revert "[LTO][Pipelines][Coro] De-duplicate Coro passes" (#129977)
Reverts llvm/llvm-project#128654 Breaks FatLTO llvm/llvm-project#128654 (comment)
2 parents fedd72b + 3ccacc4 commit 1d825ec

File tree

4 files changed

+20
-23
lines changed

4 files changed

+20
-23
lines changed

llvm/lib/Passes/PassBuilderPipelines.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -419,16 +419,14 @@ static bool isLTOPostLink(ThinOrFullLTOPhase Phase) {
419419

420420
// Helper to wrap conditionally Coro passes.
421421
static CoroConditionalWrapper buildCoroWrapper(ThinOrFullLTOPhase Phase) {
422+
// TODO: Skip passes according to Phase.
422423
ModulePassManager CoroPM;
423-
if (!isLTOPostLink(Phase))
424-
CoroPM.addPass(CoroEarlyPass());
425-
if (!isLTOPreLink(Phase)) {
426-
CGSCCPassManager CGPM;
427-
CGPM.addPass(CoroSplitPass());
428-
CoroPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(std::move(CGPM)));
429-
CoroPM.addPass(CoroCleanupPass());
430-
CoroPM.addPass(GlobalDCEPass());
431-
}
424+
CoroPM.addPass(CoroEarlyPass());
425+
CGSCCPassManager CGPM;
426+
CGPM.addPass(CoroSplitPass());
427+
CoroPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(std::move(CGPM)));
428+
CoroPM.addPass(CoroCleanupPass());
429+
CoroPM.addPass(GlobalDCEPass());
432430
return CoroConditionalWrapper(std::move(CoroPM));
433431
}
434432

@@ -1012,7 +1010,7 @@ PassBuilder::buildInlinerPipeline(OptimizationLevel Level,
10121010
MainCGPipeline.addPass(createCGSCCToFunctionPassAdaptor(
10131011
RequireAnalysisPass<ShouldNotRunFunctionPassesAnalysis, Function>()));
10141012

1015-
if (!isLTOPreLink(Phase)) {
1013+
if (Phase != ThinOrFullLTOPhase::ThinLTOPreLink) {
10161014
MainCGPipeline.addPass(CoroSplitPass(Level != OptimizationLevel::O0));
10171015
MainCGPipeline.addPass(CoroAnnotationElidePass());
10181016
}
@@ -1062,7 +1060,7 @@ PassBuilder::buildModuleInlinerPipeline(OptimizationLevel Level,
10621060
buildFunctionSimplificationPipeline(Level, Phase),
10631061
PTO.EagerlyInvalidateAnalyses));
10641062

1065-
if (!isLTOPreLink(Phase)) {
1063+
if (Phase != ThinOrFullLTOPhase::ThinLTOPreLink) {
10661064
MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(
10671065
CoroSplitPass(Level != OptimizationLevel::O0)));
10681066
MPM.addPass(
@@ -1122,8 +1120,7 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level,
11221120
// Do basic inference of function attributes from known properties of system
11231121
// libraries and other oracles.
11241122
MPM.addPass(InferFunctionAttrsPass());
1125-
if (!isLTOPostLink(Phase))
1126-
MPM.addPass(CoroEarlyPass());
1123+
MPM.addPass(CoroEarlyPass());
11271124

11281125
FunctionPassManager EarlyFPM;
11291126
EarlyFPM.addPass(EntryExitInstrumenterPass(/*PostInlining=*/false));
@@ -1293,7 +1290,7 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level,
12931290
// and argument promotion.
12941291
MPM.addPass(DeadArgumentEliminationPass());
12951292

1296-
if (!isLTOPreLink(Phase))
1293+
if (Phase != ThinOrFullLTOPhase::ThinLTOPreLink)
12971294
MPM.addPass(CoroCleanupPass());
12981295

12991296
// Optimize globals now that functions are fully simplified.
@@ -1958,6 +1955,9 @@ PassBuilder::buildLTODefaultPipeline(OptimizationLevel Level,
19581955
return MPM;
19591956
}
19601957

1958+
// TODO: Skip to match buildCoroWrapper.
1959+
MPM.addPass(CoroEarlyPass());
1960+
19611961
// Optimize globals to try and fold them into constants.
19621962
MPM.addPass(GlobalOptPass());
19631963

llvm/test/LTO/X86/coro.ll

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
; RUN: opt %s -passes='lto-pre-link<O0>' -S -o %t1.ll
2-
; RUN: FileCheck %s --check-prefixes=CHECK,PRELINK --implicit-check-not="call void @llvm.coro" --input-file=%t1.ll
3-
; RUN: llvm-as %t1.ll -o %t1.bc
1+
; RUN: llvm-as %s -o %t1.bc
42
; RUN: llvm-lto2 run %t1.bc -o %t2.o -r=%t1.bc,test,plx -r=%t1.bc,extern_func,plx -save-temps
53
; RUN: llvm-dis %t2.o.0.5.precodegen.bc -o - | FileCheck %s --implicit-check-not="call void @llvm.coro"
64

@@ -9,9 +7,7 @@ target triple = "x86_64-unknown-fuchsia"
97

108
declare void @extern_func()
119

12-
; CHECK: define{{.*}} void @test(
13-
; PRELINK: call ptr @llvm.coro.subfn.addr
14-
; PRELINK: call ptr @llvm.coro.subfn.addr
10+
; CHECK: define {{.*}} void @test(
1511
define void @test(ptr %hdl) {
1612
call void @llvm.coro.resume(ptr %hdl)
1713
call void @llvm.coro.destroy(ptr %hdl)

llvm/test/Other/new-pm-defaults.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,13 +230,13 @@
230230
; CHECK-O-NEXT: Running pass: PostOrderFunctionAttrsPass
231231
; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}ShouldNotRunFunctionPassesAnalysis
232232
; CHECK-O-NEXT: Running analysis: ShouldNotRunFunctionPassesAnalysis
233-
; CHECK-DEFAULT-NEXT: Running pass: CoroSplitPass
234-
; CHECK-DEFAULT-NEXT: Running pass: CoroAnnotationElidePass
233+
; CHECK-O-NEXT: Running pass: CoroSplitPass
234+
; CHECK-O-NEXT: Running pass: CoroAnnotationElidePass
235235
; CHECK-O-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}ShouldNotRunFunctionPassesAnalysis
236236
; CHECK-O-NEXT: Invalidating analysis: ShouldNotRunFunctionPassesAnalysis
237237
; CHECK-O-NEXT: Invalidating analysis: InlineAdvisorAnalysis
238238
; CHECK-O-NEXT: Running pass: DeadArgumentEliminationPass
239-
; CHECK-DEFAULT-NEXT: Running pass: CoroCleanupPass
239+
; CHECK-O-NEXT: Running pass: CoroCleanupPass
240240
; CHECK-O-NEXT: Running pass: GlobalOptPass
241241
; CHECK-O-NEXT: Running pass: GlobalDCEPass
242242
; CHECK-DEFAULT-NEXT: Running pass: EliminateAvailableExternallyPass

llvm/test/Other/new-pm-lto-defaults.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
; CHECK-O1-NEXT: Running analysis: TargetLibraryAnalysis
6868
; CHECK-O-NEXT: Running pass: GlobalSplitPass
6969
; CHECK-O-NEXT: Running pass: WholeProgramDevirtPass
70+
; CHECK-O23SZ-NEXT: Running pass: CoroEarlyPass
7071
; CHECK-O1-NEXT: Running pass: LowerTypeTestsPass
7172
; CHECK-O23SZ-NEXT: Running pass: GlobalOptPass
7273
; CHECK-O23SZ-NEXT: Running pass: PromotePass

0 commit comments

Comments
 (0)