aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/BackendUtil.cpp
diff options
context:
space:
mode:
authorShilei Tian <i@tianshilei.me>2024-11-03 23:24:10 -0500
committerGitHub <noreply@github.com>2024-11-03 23:24:10 -0500
commitdc45ff1d2a01ff68326c6444dba683cf66d80651 (patch)
treeb41d8dbbe8f60b2ed1145cc078433c4946fd43f6 /clang/lib/CodeGen/BackendUtil.cpp
parent798c5fbdb740f143605fd27fea5d6f914f7eb34c (diff)
downloadllvm-dc45ff1d2a01ff68326c6444dba683cf66d80651.zip
llvm-dc45ff1d2a01ff68326c6444dba683cf66d80651.tar.gz
llvm-dc45ff1d2a01ff68326c6444dba683cf66d80651.tar.bz2
[PassBuilder] Add `ThinOrFullLTOPhase` to early simplication EP call backs (#114547)
The early simplication pipeline is used in non-LTO and (Thin/Full)LTO pre-link stage. There are some passes that we want them in non-LTO mode, but not at LTO pre-link stage. The control is missing currently. This PR adds the support. To demonstrate the use, we only enable the internalization pass in non-LTO mode for AMDGPU because having it run in pre-link stage causes some issues.
Diffstat (limited to 'clang/lib/CodeGen/BackendUtil.cpp')
-rw-r--r--clang/lib/CodeGen/BackendUtil.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index ae33554..47a30f0 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -993,7 +993,8 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
createModuleToFunctionPassAdaptor(ObjCARCExpandPass()));
});
PB.registerPipelineEarlySimplificationEPCallback(
- [](ModulePassManager &MPM, OptimizationLevel Level) {
+ [](ModulePassManager &MPM, OptimizationLevel Level,
+ ThinOrFullLTOPhase) {
if (Level != OptimizationLevel::O0)
MPM.addPass(ObjCARCAPElimPass());
});