[llvm] [NFC][Pipelines] Extract buildCoroConditionalWrapper (PR #126860)
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 11 21:58:45 PST 2025
https://github.com/vitalybuka created https://github.com/llvm/llvm-project/pull/126860
Helper for #126168.
`Phase` will be used in followup patches.
>From 295fcf0c46cc21d69bef8599c0193b0c3ca99e94 Mon Sep 17 00:00:00 2001
From: Vitaly Buka <vitalybuka at google.com>
Date: Tue, 11 Feb 2025 21:58:30 -0800
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
=?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Created using spr 1.3.4
---
llvm/lib/Passes/PassBuilderPipelines.cpp | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp
index 63e70d7e182bd..adb005b5839f5 100644
--- a/llvm/lib/Passes/PassBuilderPipelines.cpp
+++ b/llvm/lib/Passes/PassBuilderPipelines.cpp
@@ -410,6 +410,19 @@ static bool isLTOPreLink(ThinOrFullLTOPhase Phase) {
Phase == ThinOrFullLTOPhase::FullLTOPreLink;
}
+// Helper to wrap conditionally Coro passes.
+static CoroConditionalWrapper buildCoroWrapper(ThinOrFullLTOPhase Phase) {
+ // TODO: Skip passes according to Phase.
+ ModulePassManager CoroPM;
+ 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));
+}
+
// TODO: Investigate the cost/benefit of tail call elimination on debugging.
FunctionPassManager
PassBuilder::buildO1FunctionSimplificationPipeline(OptimizationLevel Level,
@@ -2250,14 +2263,7 @@ PassBuilder::buildO0DefaultPipeline(OptimizationLevel Level,
MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
}
- ModulePassManager CoroPM;
- CoroPM.addPass(CoroEarlyPass());
- CGSCCPassManager CGPM;
- CGPM.addPass(CoroSplitPass());
- CoroPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(std::move(CGPM)));
- CoroPM.addPass(CoroCleanupPass());
- CoroPM.addPass(GlobalDCEPass());
- MPM.addPass(CoroConditionalWrapper(std::move(CoroPM)));
+ MPM.addPass(buildCoroWrapper(Phase));
invokeOptimizerLastEPCallbacks(MPM, Level, Phase);
More information about the llvm-commits
mailing list