[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
Mon Jul 31 18:02:04 PDT 2023


dhoekwater added a comment.

Here's a breakdown of the cases:

  Hot -> Cold [x16 is free across the branch]
    Do nothing; let the linker relax the branch.
  
  Cold -> Hot [x16 is free across the branch]
    Do nothing; let the linker relax the branch.
  
  Hot -> Cold [x16 not free, but others are]
    Spill x16; let the linker relax the branch.
  
  Cold -> Hot [x16 not free, but others are]
    Manually insert an indirect branch.
  
  Hot -> Cold [No free regs]
    Spill x16; let the linker relax the branch.
  
  Cold -> Hot [No free regs]
    Spill x16 and put the restore block at the end of the hot function; let the linker relax the branch.
    Ex:
      [Hot section]
      func.hot:
        ... hot code...
      func.restore:
        ... restore x16 ...
        B func.hot
  
      [Cold section]
        func.cold:
        ... spill x16 ...
        B func.restore


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D156767



More information about the llvm-commits mailing list