diff --git a/lib/Target/ARM/ARMRegisterInfo.cpp b/lib/Target/ARM/ARMRegisterInfo.cpp index 09420071bf2..8177c806c23 100644 --- a/lib/Target/ARM/ARMRegisterInfo.cpp +++ b/lib/Target/ARM/ARMRegisterInfo.cpp @@ -1474,7 +1474,10 @@ unsigned ARMRegisterInfo::getRARegister() const { } unsigned ARMRegisterInfo::getFrameRegister(MachineFunction &MF) const { - return STI.useThumbBacktraces() ? ARM::R7 : ARM::R11; + if (STI.isTargetDarwin() || hasFP(MF)) + return STI.useThumbBacktraces() ? ARM::R7 : ARM::R11; + else + return ARM::SP; } unsigned ARMRegisterInfo::getEHExceptionRegister() const {