Skip to content

Commit 30a7c81

Browse files
authored
[LTO][Pipelines][NFC] Exctract isLTOPostLink (#128653)
1 parent 864071d commit 30a7c81

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

llvm/lib/Passes/PassBuilderPipelines.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,12 @@ static bool isLTOPreLink(ThinOrFullLTOPhase Phase) {
411411
Phase == ThinOrFullLTOPhase::FullLTOPreLink;
412412
}
413413

414+
// Helper to check if the current compilation phase is LTO backend
415+
static bool isLTOPostLink(ThinOrFullLTOPhase Phase) {
416+
return Phase == ThinOrFullLTOPhase::ThinLTOPostLink ||
417+
Phase == ThinOrFullLTOPhase::FullLTOPostLink;
418+
}
419+
414420
// Helper to wrap conditionally Coro passes.
415421
static CoroConditionalWrapper buildCoroWrapper(ThinOrFullLTOPhase Phase) {
416422
// TODO: Skip passes according to Phase.
@@ -1613,8 +1619,7 @@ PassBuilder::buildModuleOptimizationPipeline(OptimizationLevel Level,
16131619
MPM.addPass(MergeFunctionsPass());
16141620

16151621
if (PTO.CallGraphProfile && !LTOPreLink)
1616-
MPM.addPass(CGProfilePass(LTOPhase == ThinOrFullLTOPhase::FullLTOPostLink ||
1617-
LTOPhase == ThinOrFullLTOPhase::ThinLTOPostLink));
1622+
MPM.addPass(CGProfilePass(isLTOPostLink(LTOPhase)));
16181623

16191624
// RelLookupTableConverterPass runs later in LTO post-link pipeline.
16201625
if (!LTOPreLink)

0 commit comments

Comments
 (0)