[PATCH] D32564: AArch64: compress jump tables to minimum size needed to reach destinations

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 8 12:17:22 PDT 2017


efriedma added a comment.

On 5/8/2017 9:36 AM, Tim Northover wrote:

> On 26 April 2017 at 16:33, Eli Friedman via Phabricator
>  <reviews at reviews.llvm.org> wrote:
> 
>> If you're looking to save size, we could put the jump table into the text segment just after the branch, and compute the jump destination in three instructions: one to load the address of the table, one to load the offset from the table, and one to add the offset to the address of the table.  Is there some reason we shouldn't do that?
> 
> To get that first load down to 1 instruction we'd need to guarantee
>  the jump table was within 128MB of the code, and I think we
>  technically support larger functions. So we'd have to add something
>  like ARM's full Constant Island pass instead of the newly generic
>  branch relaxation we currently do. I don't think that is worth the
>  maintenance burden, it's a constant source of bugs on ARM.
> 
> For the second offset addition, again you're compromising distance.
>  The jump table itself then has to be within 256 or 65536 bytes of
>  every basic block used. I suspect that even *with* complex placement
>  that would be tough to arrange.

We manage for Thumb (see, for example, test/CodeGen/Thumb2/thumb2-tbb.ll).  That said, I hadn't really considered the lack of existing infrastructure to implement this sort of thing on AArch64; you're right, it probably isn't worthwhile.


Repository:
  rL LLVM

https://reviews.llvm.org/D32564





More information about the llvm-commits mailing list