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

Tim Northover via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 26 15:17:28 PDT 2017


t.p.northover created this revision.
Herald added subscribers: mgorny, mcrosier, aemerson.

This patch adds a pass after branch relaxation to check whether the span of jump tables is small enough that the offsets can be encoded in 8 or 16-bits and emit appropriate sequences if so.

This improves the binary size quite significantly for some tests (it turns out not a single table in the test-suite needs 32-bits of range, and two thirds only need 8-bits).

I'm a little divided on when to enable this and whether to continue to support 64-bit absolute entries (the code sequence is slightly simpler). In the end I decided to go for simplicity on the grounds that switches probably aren't performance critical and will probably be dominated by mispredicts anyway. I'd be open to gating it on MinSize or something though.

What do you think?


Repository:
  rL LLVM

https://reviews.llvm.org/D32564

Files:
  llvm/lib/Target/AArch64/AArch64.h
  llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
  llvm/lib/Target/AArch64/AArch64CompressJumpTables.cpp
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/lib/Target/AArch64/AArch64ISelLowering.h
  llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
  llvm/lib/Target/AArch64/AArch64InstrInfo.td
  llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.h
  llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
  llvm/lib/Target/AArch64/CMakeLists.txt
  llvm/test/CodeGen/AArch64/jump-table-compress.mir
  llvm/test/CodeGen/AArch64/jump-table.ll
  llvm/test/CodeGen/AArch64/min-jump-table.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32564.96831.patch
Type: text/x-patch
Size: 34099 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170426/fe661bb0/attachment-0001.bin>


More information about the llvm-commits mailing list