[PATCH] D94355: [SimplifyCFG] Add relative switch lookup tables
Gulfem Savrun Yeniceri via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 29 16:15:24 PST 2021
gulfem marked an inline comment as done.
gulfem added a comment.
In D94355#2530225 <https://reviews.llvm.org/D94355#2530225>, @lebedev.ri wrote:
> Can you please add an explanation to the patch's description as to why
> we don't want to instead convert non-relative/relative LUT's elsewhere,
> please.
@mcgrathr gave some explanation to that:
>> Many backends generate PIC-friendly jump tables. This is about generating IR initializers that translate to the same kind of backend assembly expressions as those backends use for their jump tables.
I also want to add to that:
This task specifically tries make switch-to-lookup tables PIC-friendly, but it does not necessarily try to make all the jump tables PIC-friendly.
There is also another work going on to generate PIC-friendly vtables.
Therefore, converting non-relative lookup tables to relative tables elsewhere can be explored as a separate task.
================
Comment at: llvm/lib/Transforms/Utils/SimplifyCFG.cpp:5512-5525
+ // If not in x86 or aarch64 mode, do not generate a relative lookup table.
+ Triple TargetTriple(M.getTargetTriple());
+ if (!(TargetTriple.getArch() == Triple::x86_64 ||
+ TargetTriple.getArch() == Triple::aarch64))
+ return false;
+
+ // If not tiny or small code model, do not generate a relative lookup table.
----------------
lebedev.ri wrote:
> This should be some TLI/TTI hook.
> This should be some TLI/TTI hook.
Could you please elaborate on that?
Are you talking about getting the PIC level?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D94355/new/
https://reviews.llvm.org/D94355
More information about the cfe-commits
mailing list