[llvm] [ARM] Use FPRegs for fastcc calling convention detection. (PR #184593)

via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 4 03:29:17 PST 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-arm

Author: David Green (davemgreen)

<details>
<summary>Changes</summary>

This was using VFP2, but nowadays should use hasFPRegs to detect the effective calling convention.

Fixes #<!-- -->109922.

---
Full diff: https://github.com/llvm/llvm-project/pull/184593.diff


2 Files Affected:

- (modified) llvm/lib/Target/ARM/ARMISelLowering.cpp (+2-2) 
- (added) llvm/test/CodeGen/Thumb2/mve-fastcctail.ll (+23) 


``````````diff
diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp
index eb757df6a9f28..5e56d87b06570 100644
--- a/llvm/lib/Target/ARM/ARMISelLowering.cpp
+++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp
@@ -1714,10 +1714,10 @@ ARMTargetLowering::getEffectiveCallingConv(CallingConv::ID CC,
   case CallingConv::Fast:
   case CallingConv::CXX_FAST_TLS:
     if (!getTM().isAAPCS_ABI()) {
-      if (Subtarget->hasVFP2Base() && !Subtarget->isThumb1Only() && !isVarArg)
+      if (Subtarget->hasFPRegs() && !Subtarget->isThumb1Only() && !isVarArg)
         return CallingConv::Fast;
       return CallingConv::ARM_APCS;
-    } else if (Subtarget->hasVFP2Base() && !Subtarget->isThumb1Only() &&
+    } else if (Subtarget->hasFPRegs() && !Subtarget->isThumb1Only() &&
                !isVarArg)
       return CallingConv::ARM_AAPCS_VFP;
     else
diff --git a/llvm/test/CodeGen/Thumb2/mve-fastcctail.ll b/llvm/test/CodeGen/Thumb2/mve-fastcctail.ll
new file mode 100644
index 0000000000000..d39b6f9ca7e8b
--- /dev/null
+++ b/llvm/test/CodeGen/Thumb2/mve-fastcctail.ll
@@ -0,0 +1,23 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6
+; RUN: llc -mtriple=thumbv8.1m.main-none-none-eabihf -mattr=+mve -verify-machineinstrs %s -o - | FileCheck %s
+
+%struct.S51 = type { <16 x i8>, <16 x i8> }
+
+define internal %struct.S51 @F33() {
+; CHECK-LABEL: F33:
+; CHECK:       @ %bb.0: @ %entry
+; CHECK-NEXT:    vmov.i32 q0, #0x0
+; CHECK-NEXT:    vmov.i32 q1, #0x0
+; CHECK-NEXT:    bx lr
+entry:
+  ret %struct.S51 zeroinitializer
+}
+
+define internal fastcc void @F32() {
+; CHECK-LABEL: F32:
+; CHECK:       @ %bb.0: @ %entry
+; CHECK-NEXT:    b F33
+entry:
+  %call = tail call %struct.S51 @F33()
+  ret void
+}

``````````

</details>


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


More information about the llvm-commits mailing list