[all-commits] [llvm/llvm-project] cab340: [AArch64][SME] Avoid ZA save state changes in loop...

Benjamin Maxwell via All-commits all-commits at lists.llvm.org
Wed Jul 16 03:37:58 PDT 2025


  Branch: refs/heads/users/MacDue/sme-loops
  Home:   https://github.com/llvm/llvm-project
  Commit: cab3409343e2a9d1835f01a4d583ddf58c0dac75
      https://github.com/llvm/llvm-project/commit/cab3409343e2a9d1835f01a4d583ddf58c0dac75
  Author: Benjamin Maxwell <benjamin.maxwell at arm.com>
  Date:   2025-07-16 (Wed, 16 Jul 2025)

  Changed paths:
    M llvm/lib/Target/AArch64/AArch64.h
    M llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
    M llvm/lib/Target/AArch64/MachineSMEABIPass.cpp
    A llvm/test/CodeGen/AArch64/sme-lazy-save-in-loop.ll
    M llvm/test/CodeGen/AArch64/sme-za-control-flow.ll

  Log Message:
  -----------
  [AArch64][SME] Avoid ZA save state changes in loops in MachineSMEABIPass

This patch uses the MachineLoopInfo to give blocks within loops a higher
weight when choosing the bundle ZA state. MachineLoopInfo does not find
loop trip counts, so this uses an arbitrary weight (default 10), which
can be configured with the `-aarch64-sme-abi-loop-edge-weight` flag.

This makes the MachineSMEABIPass pass more likely to pick a bundle state
that matches the loop's entry/exit state, which avoids state changes in
the loop (which we assume will happen more than once).

This does require some extra analysis, so this is only enabled at -O1
and above.

Change-Id: If318c809d2f7cc1fca144fbe424ba2a2ca7fb19f



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