[llvm] r222056 - ARM: correctly calculate the offset of FP in its push.
Tim Northover
tnorthover at apple.com
Fri Nov 14 14:45:31 PST 2014
Author: tnorthover
Date: Fri Nov 14 16:45:31 2014
New Revision: 222056
URL: http://llvm.org/viewvc/llvm-project?rev=222056&view=rev
Log:
ARM: correctly calculate the offset of FP in its push.
When we folded the DPR alignment gap into a push, we weren't noting the extra
distance from the beginning of the push to the FP, and so FP ended up pointing
at an incorrect offset.
The .cfi_def_cfa_offset directives are still wrong in this case, but I think
that can be improved by refactoring.
Modified:
llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp
llvm/trunk/test/CodeGen/ARM/dwarf-unwind.ll
Modified: llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp?rev=222056&r1=222055&r2=222056&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp Fri Nov 14 16:45:31 2014
@@ -282,9 +282,15 @@ void ARMFrameLowering::emitPrologue(Mach
// Prolog/epilog inserter assumes we correctly align DPRs on the stack, so our
// .cfi_offset operations will reflect that.
+ unsigned adjustedGPRCS1Size = GPRCS1Size;
if (DPRGapSize) {
assert(DPRGapSize == 4 && "unexpected alignment requirements for DPRs");
- if (!tryFoldSPUpdateIntoPushPop(STI, MF, LastPush, DPRGapSize))
+ if (tryFoldSPUpdateIntoPushPop(STI, MF, LastPush, DPRGapSize)) {
+ if (LastPush == GPRCS1Push) {
+ FramePtrOffsetInPush += DPRGapSize;
+ adjustedGPRCS1Size += DPRGapSize;
+ }
+ } else
emitSPUpdate(isARM, MBB, MBBI, dl, TII, -DPRGapSize,
MachineInstr::FrameSetup);
}
@@ -354,7 +360,6 @@ void ARMFrameLowering::emitPrologue(Mach
NumBytes = 0;
}
- unsigned adjustedGPRCS1Size = GPRCS1Size;
if (NumBytes) {
// Adjust SP after all the callee-save spills.
if (tryFoldSPUpdateIntoPushPop(STI, MF, LastPush, NumBytes)) {
Modified: llvm/trunk/test/CodeGen/ARM/dwarf-unwind.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/dwarf-unwind.ll?rev=222056&r1=222055&r2=222056&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/dwarf-unwind.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/dwarf-unwind.ll Fri Nov 14 16:45:31 2014
@@ -66,3 +66,12 @@ define void @test_nodpr_noalign(i8 %l, i
call void @bar()
ret void
}
+
+define void @test_frame_pointer_offset() minsize "no-frame-pointer-elim"="true" {
+; CHECK-LABEL: test_frame_pointer_offset:
+; CHECK: push.w {r3, r4, r5, r6, r7, r8, r9, r10, r11, lr}
+; CHECK: add r7, sp, #16
+ call void asm sideeffect "", "~{r4},~{r5},~{r6},~{r7},~{r8},~{r9},~{r10},~{r11},~{d8}"()
+ call void @bar()
+ ret void
+}
\ No newline at end of file
More information about the llvm-commits
mailing list