[llvm] [AArch64][SME] Add pass remarks to the MachineSMEABIPass (PR #170277)
Sander de Smalen via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 4 02:41:41 PST 2025
================
@@ -0,0 +1,119 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -mtriple=aarch64 -mattr=+sme2 --pass-remarks-analysis=sme -o /dev/null < %s 2>&1 | FileCheck %s
+; RUN: llc -mtriple=aarch64 -mattr=+sme2 --aarch64-new-sme-abi --pass-remarks-analysis=sme -o /dev/null < %s 2>&1 | FileCheck %s --check-prefix=CHECK-NEWLOWERING
+
+declare void @private_za_callee()
+declare void @private_za_callee_a()
+declare void @private_za_callee_b()
+declare void @private_za_callee_c()
+
+declare void @shared_za_callee() "aarch64_inout_za"
+declare void @shared_za_zt0_callee() "aarch64_inout_za" "aarch64_inout_zt0"
+
+; Note: These remarks are more useful with source debug info (which gives line numbers for `<unknown>:0:0`).
+
+define void @test_lazy_save_1_callee() nounwind "aarch64_inout_za" {
+; CHECK: remark: <unknown>:0:0: call from 'test_lazy_save_1_callee' to 'private_za_callee' sets up a lazy save for ZA
+
+; CHECK-NEWLOWERING: remark: <unknown>:0:0: lazy save of ZA emitted in 'test_lazy_save_1_callee'
+; CHECK-NEWLOWERING-NEXT: remark: <unknown>:0:0: call to 'private_za_callee' requires ZA save
+ call void @private_za_callee()
+ ret void
+}
+
+define void @test_lazy_save_2_callees() nounwind "aarch64_inout_za" {
+; CHECK: remark: <unknown>:0:0: call from 'test_lazy_save_2_callees' to 'private_za_callee' sets up a lazy save for ZA
+; CHECK: remark: <unknown>:0:0: call from 'test_lazy_save_2_callees' to 'private_za_callee' sets up a lazy save for ZA
+
+; CHECK-NEWLOWERING: remark: <unknown>:0:0: lazy save of ZA emitted in 'test_lazy_save_2_callees'
+; CHECK-NEWLOWERING-NEXT: remark: <unknown>:0:0: call to 'private_za_callee' requires ZA save
+ call void @private_za_callee()
+ call void @private_za_callee()
+ ret void
+}
+
+define float @test_lazy_save_expanded_intrinsic(float %a) nounwind "aarch64_inout_za" {
+; CHECK: remark: <unknown>:0:0: call from 'test_lazy_save_expanded_intrinsic' to 'cosf' sets up a lazy save for ZA
+
+; CHECK-NEWLOWERING: remark: <unknown>:0:0: lazy save of ZA emitted in 'test_lazy_save_expanded_intrinsic'
+; CHECK-NEWLOWERING-NEXT: remark: <unknown>:0:0: call to 'cosf' requires ZA save
+ %res = call float @llvm.cos.f32(float %a)
+ ret float %res
+}
+
+define void @test_lazy_save_multiple_paths(i1 %a) "aarch64_inout_za" {
+; CHECK: remark: <unknown>:0:0: call from 'test_lazy_save_multiple_paths' to 'private_za_callee_a' sets up a lazy save for ZA
+; CHECK: remark: <unknown>:0:0: call from 'test_lazy_save_multiple_paths' to 'private_za_callee_b' sets up a lazy save for ZA
+; CHECK: remark: <unknown>:0:0: call from 'test_lazy_save_multiple_paths' to 'private_za_callee_c' sets up a lazy save for ZA
+
+; CHECK-NEWLOWERING: remark: <unknown>:0:0: lazy save of ZA emitted in 'test_lazy_save_multiple_paths'
+; CHECK-NEWLOWERING-NEXT: remark: <unknown>:0:0: call to 'private_za_callee_b' requires ZA save
+; CHECK-NEWLOWERING-NEXT: remark: <unknown>:0:0: call to 'private_za_callee_a' requires ZA save
----------------
sdesmalen-arm wrote:
Would it be more useful to print:
```call from 'test_lazy_save_multiple_paths' -> 'private_za_callee_b' requires ZA/ZT0 save```
rather than having the two different messages? I got a bit confused for the function down below, which has:
```
remark: <unknown>:0:0: spill of ZT0 emitted in 'test_lazy_save_with_zt0_reload'
remark: <unknown>:0:0: call to 'shared_za_callee' requires ZT0 save
remark: <unknown>:0:0: spill of ZT0 emitted in 'test_lazy_save_with_zt0_reload'
remark: <unknown>:0:0: lazy save of ZA emitted in 'test_lazy_save_with_zt0_reload'
remark: <unknown>:0:0: call to 'private_za_callee' requires ZA save
```
I'd personally find it more useful if this would say:
```
remark: <unknown>:0:0: call from 'test_lazy_save_with_zt0_reload' -> 'shared_za_callee' requires ZT0 save
remark: <unknown>:0:0: call from 'test_lazy_save_with_zt0_reload' -> 'private_za_callee' requires ZA save
```
https://github.com/llvm/llvm-project/pull/170277
More information about the llvm-commits
mailing list