[all-commits] [llvm/llvm-project] a38e1a: [AArch64][SME2] Don't preserve ZT0 around SME ABI ...

Benjamin Maxwell via All-commits all-commits at lists.llvm.org
Fri May 9 13:19:02 PDT 2025


  Branch: refs/heads/release/20.x
  Home:   https://github.com/llvm/llvm-project
  Commit: a38e1ae2041db6815c482b5194718409ff2e742c
      https://github.com/llvm/llvm-project/commit/a38e1ae2041db6815c482b5194718409ff2e742c
  Author: Benjamin Maxwell <benjamin.maxwell at arm.com>
  Date:   2025-05-09 (Fri, 09 May 2025)

  Changed paths:
    M llvm/lib/Target/AArch64/Utils/AArch64SMEAttributes.h
    M llvm/test/CodeGen/AArch64/sme-disable-gisel-fisel.ll
    M llvm/test/CodeGen/AArch64/sme-zt0-state.ll

  Log Message:
  -----------
  [AArch64][SME2] Don't preserve ZT0 around SME ABI routines (#132722)

This caused ZT0 to be preserved around `__arm_tpidr2_save` in functions
with "aarch64_new_zt0". The block in which `__arm_tpidr2_save` is called
is added by the SMEABIPass and may be reachable in cases where ZA has
not been enabled* (so using `str zt0` is invalid).

* (when za_save_buffer is null and num_za_save_slices is zero)


  Commit: 069ef671e0aba3874e690750ad95c59a437b0c34
      https://github.com/llvm/llvm-project/commit/069ef671e0aba3874e690750ad95c59a437b0c34
  Author: Benjamin Maxwell <benjamin.maxwell at arm.com>
  Date:   2025-05-09 (Fri, 09 May 2025)

  Changed paths:
    M llvm/lib/IR/Verifier.cpp
    M llvm/lib/Target/AArch64/SMEABIPass.cpp
    M llvm/lib/Target/AArch64/Utils/AArch64SMEAttributes.cpp
    M llvm/lib/Target/AArch64/Utils/AArch64SMEAttributes.h
    A llvm/test/CodeGen/AArch64/sme-new-zt0-function.ll
    M llvm/test/CodeGen/AArch64/sme-zt0-state.ll
    M llvm/test/Verifier/sme-attributes.ll
    M llvm/unittests/Target/AArch64/SMEAttributesTest.cpp

  Log Message:
  -----------
  [AArch64][SME] Allow spills of ZT0 around SME ABI routines again (#136726)

In #132722 spills of ZT0 were disabled around all SME ABI routines to
avoid a case where ZT0 is spilled before ZA is enabled (resulting in a
crash).

It turns out that the ABI does not promise that routines will preserve
ZT0 (however in practice they do), so generally disabling ZT0 spills for
ABI routines is not correct.

The case where a crash was possible was "aarch64_new_zt0" functions with
ZA disabled on entry and a ZT0 spill around __arm_tpidr2_save. In this
case, ZT0 will be undefined at the call to __arm_tpidr2_save, so this
patch avoids the ZT0 spill by marking the callsite with
"aarch64_zt0_undef". This attribute only applies to callsites and marks
that at the point the call is made ZT0 is not defined, so does not need
preserving.


Compare: https://github.com/llvm/llvm-project/compare/be4097b6ee57...069ef671e0ab

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