[llvm] 3890215 - [PassBuilder] Add RelLookupTableConverterPass to LTO (#124053)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 28 15:08:05 PST 2025
Author: gulfemsavrun
Date: 2025-01-28T15:08:03-08:00
New Revision: 38902153fe66cb7a0685728a5a489dff944b4033
URL: https://github.com/llvm/llvm-project/commit/38902153fe66cb7a0685728a5a489dff944b4033
DIFF: https://github.com/llvm/llvm-project/commit/38902153fe66cb7a0685728a5a489dff944b4033.diff
LOG: [PassBuilder] Add RelLookupTableConverterPass to LTO (#124053)
[PassBuilder] Add RelLookupTableConverterPass to LTO
This patch adds RelLookupTableConverterPass into the LTO
post-link optimization pass pipeline. This optimization
converts lookup tables to relative lookup tables to make
them PIC-friendly, which is already included in the non-LTO
pass pipeline. This patch adds this optimization to the
post-link optimization pipeline to discover more
opportunities in the LTO context.
Added:
Modified:
llvm/docs/ReleaseNotes.md
llvm/lib/Passes/PassBuilderPipelines.cpp
llvm/test/Other/new-pm-lto-defaults.ll
Removed:
################################################################################
diff --git a/llvm/docs/ReleaseNotes.md b/llvm/docs/ReleaseNotes.md
index 29bf284617b433..e0acb8f48c5b94 100644
--- a/llvm/docs/ReleaseNotes.md
+++ b/llvm/docs/ReleaseNotes.md
@@ -133,6 +133,8 @@ Changes to TableGen
Changes to Interprocedural Optimizations
----------------------------------------
+* Added RelLookupTableConverterPass to LTO post-link pass pipeline.
+
Changes to the AArch64 Backend
------------------------------
diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp
index 4ec0fb8fc81ea4..17ff3bd37884b7 100644
--- a/llvm/lib/Passes/PassBuilderPipelines.cpp
+++ b/llvm/lib/Passes/PassBuilderPipelines.cpp
@@ -1594,9 +1594,7 @@ PassBuilder::buildModuleOptimizationPipeline(OptimizationLevel Level,
MPM.addPass(CGProfilePass(LTOPhase == ThinOrFullLTOPhase::FullLTOPostLink ||
LTOPhase == ThinOrFullLTOPhase::ThinLTOPostLink));
- // TODO: Relative look table converter pass caused an issue when full lto is
- // enabled. See https://reviews.llvm.org/D94355 for more details.
- // Until the issue fixed, disable this pass during pre-linking phase.
+ // RelLookupTableConverterPass runs later in LTO post-link pipeline.
if (!LTOPreLink)
MPM.addPass(RelLookupTableConverterPass());
@@ -2121,6 +2119,8 @@ PassBuilder::buildLTODefaultPipeline(OptimizationLevel Level,
if (PTO.MergeFunctions)
MPM.addPass(MergeFunctionsPass());
+ MPM.addPass(RelLookupTableConverterPass());
+
if (PTO.CallGraphProfile)
MPM.addPass(CGProfilePass(/*InLTOPostLink=*/true));
diff --git a/llvm/test/Other/new-pm-lto-defaults.ll b/llvm/test/Other/new-pm-lto-defaults.ll
index f788db1e338a1e..59d9ee24527b64 100644
--- a/llvm/test/Other/new-pm-lto-defaults.ll
+++ b/llvm/test/Other/new-pm-lto-defaults.ll
@@ -146,6 +146,7 @@
; CHECK-O23SZ-NEXT: Running pass: SimplifyCFGPass
; CHECK-O23SZ-NEXT: Running pass: EliminateAvailableExternallyPass
; CHECK-O23SZ-NEXT: Running pass: GlobalDCEPass
+; CHECK-O23SZ-NEXT: Running pass: RelLookupTableConverterPass
; CHECK-O23SZ-NEXT: Running pass: CGProfilePass
; CHECK-EP-NEXT: Running pass: NoOpModulePass
; CHECK-O-NEXT: Running pass: AnnotationRemarksPass on foo
More information about the llvm-commits
mailing list