[PATCH] D156767: [AArch64] [BranchRelaxation] Optimize for hot code size in AArch64 branch relaxation

Daniel Hoekwater via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 16 13:53:07 PDT 2023


dhoekwater updated this revision to Diff 550878.
dhoekwater marked 3 inline comments as done.
dhoekwater added a comment.

Without this patch, out-of-range branches are correctly relaxed, but
they are relaxed suboptimally. Notably, most (~99%) of out-of-range
unconditional branches have X16 available across the branch, where we
can safely defer to the linker rather than inserting 2 extra
instructions. Because machine function splitting (MFS) makes
unconditional branches to cold blocks out of range, enabling MFS would
incur a big code size overhead due to cross-section branch relaxation.
This patch lets us mitigate that overhead in the vast majority of cases.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156767/new/

https://reviews.llvm.org/D156767

Files:
  llvm/lib/CodeGen/BranchRelaxation.cpp
  llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
  llvm/test/CodeGen/AArch64/branch-relax-b.ll
  llvm/test/CodeGen/AArch64/branch-relax-cross-section.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156767.550878.patch
Type: text/x-patch
Size: 30169 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230816/5703d121/attachment.bin>


More information about the llvm-commits mailing list