[llvm] AArch64: Use LibcallLoweringInfo in MachineSMEABI pass (PR #176777)

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 24 04:49:51 PST 2026


================
@@ -1046,14 +1066,17 @@ void MachineSMEABI::emitFullZASaveRestore(EmitContext &Context,
   BuildMI(MBB, MBBI, DL, TII->get(TargetOpcode::COPY), BufferPtr)
       .addReg(Context.getAgnosticZABufferPtr(*MF));
 
+  RTLIB::LibcallImpl LibcallImpl = getLibcallImpl(
+      IsSave ? RTLIB::SMEABI_SME_SAVE : RTLIB::SMEABI_SME_RESTORE);
+  StringRef FuncName =
+      RTLIB::RuntimeLibcallsInfo::getLibcallImplName(LibcallImpl);
+  CallingConv::ID CC = Libcalls->getLibcallImplCallingConv(LibcallImpl);
+
   // Call __arm_sme_save/__arm_sme_restore.
   BuildMI(MBB, MBBI, DL, TII->get(AArch64::BL))
       .addReg(BufferPtr, RegState::Implicit)
-      .addExternalSymbol(TLI->getLibcallName(
-          IsSave ? RTLIB::SMEABI_SME_SAVE : RTLIB::SMEABI_SME_RESTORE))
-      .addRegMask(TRI->getCallPreservedMask(
-          *MF,
-          CallingConv::AArch64_SME_ABI_Support_Routines_PreserveMost_From_X1));
----------------
MacDue wrote:

Can we go with #177762? I'd prefer not to lose the documentation within the pass as to what the expected CC is, as the surrounding code/pass is not correct for arbitrary CCs.

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


More information about the llvm-commits mailing list