[clang] [llvm] [ARM] Save floating point registers and status registers with save_fp function attribute (PR #89654)
Benson Chu via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 27 15:01:54 PST 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")) {
----------------
pestctrl wrote:
How about we check for if if the subtarget has FP registers?
```
if (STI.hasFPRegs() && F.hasFnAttribute("save-fp"))
```
https://github.com/llvm/llvm-project/pull/89654
More information about the llvm-commits
mailing list