Skip to content

Commit 3890215

Browse files
authored
[PassBuilder] Add RelLookupTableConverterPass to LTO (llvm#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.
1 parent 3812189 commit 3890215

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

llvm/docs/ReleaseNotes.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ Changes to TableGen
133133
Changes to Interprocedural Optimizations
134134
----------------------------------------
135135

136+
* Added RelLookupTableConverterPass to LTO post-link pass pipeline.
137+
136138
Changes to the AArch64 Backend
137139
------------------------------
138140

llvm/lib/Passes/PassBuilderPipelines.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1594,9 +1594,7 @@ PassBuilder::buildModuleOptimizationPipeline(OptimizationLevel Level,
15941594
MPM.addPass(CGProfilePass(LTOPhase == ThinOrFullLTOPhase::FullLTOPostLink ||
15951595
LTOPhase == ThinOrFullLTOPhase::ThinLTOPostLink));
15961596

1597-
// TODO: Relative look table converter pass caused an issue when full lto is
1598-
// enabled. See https://reviews.llvm.org/D94355 for more details.
1599-
// Until the issue fixed, disable this pass during pre-linking phase.
1597+
// RelLookupTableConverterPass runs later in LTO post-link pipeline.
16001598
if (!LTOPreLink)
16011599
MPM.addPass(RelLookupTableConverterPass());
16021600

@@ -2121,6 +2119,8 @@ PassBuilder::buildLTODefaultPipeline(OptimizationLevel Level,
21212119
if (PTO.MergeFunctions)
21222120
MPM.addPass(MergeFunctionsPass());
21232121

2122+
MPM.addPass(RelLookupTableConverterPass());
2123+
21242124
if (PTO.CallGraphProfile)
21252125
MPM.addPass(CGProfilePass(/*InLTOPostLink=*/true));
21262126

llvm/test/Other/new-pm-lto-defaults.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@
146146
; CHECK-O23SZ-NEXT: Running pass: SimplifyCFGPass
147147
; CHECK-O23SZ-NEXT: Running pass: EliminateAvailableExternallyPass
148148
; CHECK-O23SZ-NEXT: Running pass: GlobalDCEPass
149+
; CHECK-O23SZ-NEXT: Running pass: RelLookupTableConverterPass
149150
; CHECK-O23SZ-NEXT: Running pass: CGProfilePass
150151
; CHECK-EP-NEXT: Running pass: NoOpModulePass
151152
; CHECK-O-NEXT: Running pass: AnnotationRemarksPass on foo

0 commit comments

Comments
 (0)