[all-commits] [llvm/llvm-project] 899663: [AArch64] New pass for code layout optimizations. ...

Ahmad Yasin via All-commits all-commits at lists.llvm.org
Sun May 10 13:24:07 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 899663966c7e27dcd211b002d9eed6725b6d52ff
      https://github.com/llvm/llvm-project/commit/899663966c7e27dcd211b002d9eed6725b6d52ff
  Author: Ahmad Yasin <ahmad.yasin at apple.com>
  Date:   2026-05-10 (Sun, 10 May 2026)

  Changed paths:
    M llvm/lib/Target/AArch64/AArch64.h
    A llvm/lib/Target/AArch64/AArch64CodeLayoutOpt.cpp
    M llvm/lib/Target/AArch64/AArch64Features.td
    M llvm/lib/Target/AArch64/AArch64Processors.td
    M llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
    M llvm/lib/Target/AArch64/CMakeLists.txt
    M llvm/test/CodeGen/AArch64/O3-pipeline.ll
    A llvm/test/CodeGen/AArch64/code-layout-opt.ll

  Log Message:
  -----------
  [AArch64] New pass for code layout optimizations. (#184434)

This pass is intended to optimize code layout prior to AsmPrinter. The
initial version handles two known cases:
I.  FCMP-FCSEL
II. CMP/CMN-CSEL, 32-bit only

Using existing directives, the pass induces function-alignment (of
64-bytes by default) when a pair is detected, and possibly induces
block-alignment of up to 4-bytes on top of that if the pair would
straddle cache-lines.
 
Beyond performance improvement, this pass reduces noise due to code
layout thus stabilizes measured performance over-time. For example,
knock-out effects on a "sensitive function" won't be triggered by
codegen changes outside it.

Enabled by default on processors with the new `FeatureAlignCmpCSelPairs`
subtarget feature (gated per sub-case by `FeatureFuseCmpCSel` /
`FeatureFuseFCmpFCSel`); each case can also be forced through the
`-aarch64-code-layout-opt` enumerated bit-mask

---------

Co-authored-by: Jon Roelofs <jroelofs at gmail.com>
rdar://171283264



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list