[llvm] [AArch64][SME] Remove unused ZA lazy-save (PR #81648)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 19 05:59:26 PDT 2024


================
@@ -8203,6 +8242,17 @@ AArch64TargetLowering::LowerCall(CallLoweringInfo &CLI,
         ISD::INTRINSIC_VOID, DL, MVT::Other, Result,
         DAG.getConstant(Intrinsic::aarch64_sme_set_tpidr2, DL, MVT::i32),
         DAG.getConstant(0, DL, MVT::i64));
+    TPIDR2.Uses++;
+    FuncInfo->setTPIDR2Obj(TPIDR2);
+  }
+
+  if (std::optional<TPIDR2Object> TPIDR2 = FuncInfo->getTPIDR2Obj()) {
+    if (auto Global = dyn_cast<GlobalAddressSDNode>(Callee)) {
+      if (Global->getGlobal()->getName() == "__arm_tpidr2_save") {
+        TPIDR2->Uses++;
+        FuncInfo->setTPIDR2Obj(*TPIDR2);
+      }
----------------
sdesmalen-arm wrote:

I don't understand the reasoning for doing this. There is nothing to suggest that a call to `__arm_tpidr2_save` requires a buffer in the current frame.

For example, take a function `bar` that has `__arm_new("za")` which is called by `foo` which has active ZA state.
Then `bar` will emit a call to `__arm_tpidr2_save` to save any ZA state that is live in `foo`, to a buffer that was allocated by `foo`. This is not related to to the lazy-save buffer that `bar` may require when calling a function with a Private-ZA interface.

https://github.com/llvm/llvm-project/pull/81648


More information about the llvm-commits mailing list