[PATCH] D144701: [COFF] Put jump table in .rdata for Windows
Wei Xiao via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 28 03:25:55 PST 2023
wxiao3 added a comment.
In D144701#4157624 <https://reviews.llvm.org/D144701#4157624>, @mstorsjo wrote:
> Note that this behaviour isn't entirely strictly uniform across all COFF targets. See D57277 <https://reviews.llvm.org/D57277>, where the AArch64 target was changed to move jumptables on COFF to the text section. This change was then later reversed in D113576 <https://reviews.llvm.org/D113576> when the AArch64/COFF target supported the relevant relocations.
>
> Before this change, COFF on x86_32 and aarch64 put the jumptables in rdata, while x86_64 and arm (use `thumbv7` in triples passed to llc) put them in the text section (in the case of arm, the jumptable is emitted inline in the function and not after it). This patch seems to change the output of x86_64, but doesn't affect the others. I think it would be good to clarify this aspect in the commit message and wording. I'm mildly concerned about how it affects other targets when this is universal code for COFF, but at least on a quick test it didn't make any difference for the arm case (the only one where the jump tables would be left in the text section).
>
> The testcase here seems a bit brittle; if I run this testcase with an `aarch64-pc-win32` triple, I don't get any jumptable generated at all, since it can mostly be optimized out. See e.g. llvm/test/CodeGen/AArch64/win64-jumptable.ll for a less brittle testcase.
Thanks for the comments! I have refactored the patch accordingly.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144701/new/
https://reviews.llvm.org/D144701
More information about the llvm-commits
mailing list