From: Tim Northover Date: Fri, 4 Oct 2019 12:29:32 +0000 (+0000) Subject: ARM-Darwin: keep the frame register reserved even if not updated. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dc3e84b27df3f364c6efc3e4c80dc6ae08f7b654;p=llvm ARM-Darwin: keep the frame register reserved even if not updated. Darwin platforms need the frame register to always point at a valid record even if it's not updated in a leaf function. Backtraces are more important than one extra GPR. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@373738 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/ARM/ARMBaseRegisterInfo.cpp b/lib/Target/ARM/ARMBaseRegisterInfo.cpp index 46382816b98..1eaf871867e 100644 --- a/lib/Target/ARM/ARMBaseRegisterInfo.cpp +++ b/lib/Target/ARM/ARMBaseRegisterInfo.cpp @@ -191,7 +191,7 @@ getReservedRegs(const MachineFunction &MF) const { markSuperRegs(Reserved, ARM::PC); markSuperRegs(Reserved, ARM::FPSCR); markSuperRegs(Reserved, ARM::APSR_NZCV); - if (TFI->hasFP(MF)) + if (TFI->hasFP(MF) || STI.isTargetDarwin()) markSuperRegs(Reserved, getFramePointerReg(STI)); if (hasBasePointer(MF)) markSuperRegs(Reserved, BasePtr); diff --git a/test/CodeGen/ARM/r7-fixed-darwin.ll b/test/CodeGen/ARM/r7-fixed-darwin.ll new file mode 100644 index 00000000000..dc59b6acb42 --- /dev/null +++ b/test/CodeGen/ARM/r7-fixed-darwin.ll @@ -0,0 +1,15 @@ +; RUN: llc -mtriple=thumbv7k-apple-watchos %s -o - | FileCheck %s + +; r7 is FP on Darwin, and should be preserved even if we don't create a new +; frame record for this leaf function. So make huge register pressure to try & +; tempt LLVM to use it. +define void @foo([16 x i32]* %ptr) { +; CHECK-LABEL: foo: +; CHECK: push.w +; CHECK: .cfi_offset r7 +; CHECK-NOT: r7 +; CHECK: pop.w + %val = load volatile [16 x i32], [16 x i32]* %ptr + store volatile [16 x i32] %val, [16 x i32]* %ptr + ret void +} diff --git a/test/CodeGen/Thumb/long.ll b/test/CodeGen/Thumb/long.ll index fbf4b08fd06..856196af71f 100644 --- a/test/CodeGen/Thumb/long.ll +++ b/test/CodeGen/Thumb/long.ll @@ -234,7 +234,7 @@ if.end: %c = add i64 %y, 47 call void @f13(i64 %c) ; CHECK: adds -; CHECK-NEXT: adcs +; CHECK: adcs ; CHECK: bl ret void } diff --git a/test/CodeGen/Thumb2/2010-03-15-AsmCCClobber.ll b/test/CodeGen/Thumb2/2010-03-15-AsmCCClobber.ll index b28f4542cf3..b00554af680 100644 --- a/test/CodeGen/Thumb2/2010-03-15-AsmCCClobber.ll +++ b/test/CodeGen/Thumb2/2010-03-15-AsmCCClobber.ll @@ -17,7 +17,7 @@ target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32- ; CHECK: bl _f2 ; CHECK: clz {{r[0-9]+}} ; CHECK-DAG: lsrs {{r[0-9]+}} -; CHECK-DAG: lsls {{r[0-9]+}} +; CHECK-DAG: lsl.w {{r[0-9]+}} ; CHECK-NEXT: orr.w {{r[0-9]+}} ; CHECK-NEXT: InlineAsm Start define void @test(%s1* %this, i32 %format, i32 %w, i32 %h, i32 %levels, i32* %s, i8* %data, i32* nocapture %rowbytes, void (i8*, i8*)* %release, i8* %info) nounwind {