Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions llvm/lib/Passes/PassBuilderPipelines.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,12 @@ static bool isLTOPreLink(ThinOrFullLTOPhase Phase) {
Phase == ThinOrFullLTOPhase::FullLTOPreLink;
}

// Helper to check if the current compilation phase is LTO backend
static bool isLTOPostLink(ThinOrFullLTOPhase Phase) {
return Phase == ThinOrFullLTOPhase::ThinLTOPostLink ||
Phase == ThinOrFullLTOPhase::FullLTOPostLink;
}

// Helper to wrap conditionally Coro passes.
static CoroConditionalWrapper buildCoroWrapper(ThinOrFullLTOPhase Phase) {
// TODO: Skip passes according to Phase.
Expand Down Expand Up @@ -1613,8 +1619,7 @@ PassBuilder::buildModuleOptimizationPipeline(OptimizationLevel Level,
MPM.addPass(MergeFunctionsPass());

if (PTO.CallGraphProfile && !LTOPreLink)
MPM.addPass(CGProfilePass(LTOPhase == ThinOrFullLTOPhase::FullLTOPostLink ||
LTOPhase == ThinOrFullLTOPhase::ThinLTOPostLink));
MPM.addPass(CGProfilePass(isLTOPostLink(LTOPhase)));

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