[llvm] [LTO][Pipelines][Coro] De-duplicate Coro passes (PR #128654)
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 25 18:46:28 PST 2025
https://github.com/vitalybuka updated https://github.com/llvm/llvm-project/pull/128654
>From 250d83255545f68afe144a47eb985ea355e3ea44 Mon Sep 17 00:00:00 2001
From: Vitaly Buka <vitalybuka at google.com>
Date: Tue, 25 Feb 2025 00:24:14 -0800
Subject: [PATCH 1/2] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20ch?=
=?UTF-8?q?anges=20to=20main=20this=20commit=20is=20based=20on?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Created using spr 1.3.4
[skip ci]
---
llvm/lib/Passes/PassBuilderPipelines.cpp | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp
index 4632a0e46908e..6ca2f90aa0668 100644
--- a/llvm/lib/Passes/PassBuilderPipelines.cpp
+++ b/llvm/lib/Passes/PassBuilderPipelines.cpp
@@ -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.
@@ -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)
>From 5143ce91116d292d9f59048bfa92101a9fcd9bad Mon Sep 17 00:00:00 2001
From: Vitaly Buka <vitalybuka at google.com>
Date: Tue, 25 Feb 2025 15:11:39 -0800
Subject: [PATCH 2/2] rebase
Created using spr 1.3.4
---
llvm/lib/Passes/PassBuilderPipelines.cpp | 1 -
1 file changed, 1 deletion(-)
diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp
index 38f4ff5fab7e1..53fdaa8d9a2a8 100644
--- a/llvm/lib/Passes/PassBuilderPipelines.cpp
+++ b/llvm/lib/Passes/PassBuilderPipelines.cpp
@@ -419,7 +419,6 @@ 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());
More information about the llvm-commits
mailing list