[clang] [llvm] [ARM] Save floating point registers and status registers with save_fp function attribute (PR #89654)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 23 17:37:27 PDT 2024


================
@@ -80,13 +80,47 @@ ARMBaseRegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const {
                                        ? CSR_ATPCS_SplitPush_SwiftTail_SaveList
                                        : CSR_AAPCS_SwiftTail_SaveList);
   } else if (F.hasFnAttribute("interrupt")) {
+
+    // Don't bother saving the floating point registers if target is not hard
+    // float. This will prevent the Thumb1FrameLowering (cortex-m0) from
+    // crashing due to an llvm_unreachable being triggered when a D-class
+    // register is in the calling convention.
+    if (STI.isTargetHardFloat() && F.hasFnAttribute("save-fp")) {
----------------
efriedma-quic wrote:

It's a little weird to check isTargetHardFloat here... that just refers to whether the calling convention passes arguments in integer registers or FP registers.  It doesn't have anything to do with whether floating-point registers are used.

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


More information about the llvm-commits mailing list