Skip to content

Commit 3cc62b3

Browse files
author
Sergey Dmitrouk
committedApr 8, 2015
[ARM][Debug Info] Restore emitting of .cfi_def_cfa_offset for functions without stack frame
Summary: Looks like new code from [[ http://reviews.llvm.org/rL222057 | rL222057 ]] doesn't account for early `return` in `ARMFrameLowering::emitPrologue`, which leads to loosing `.cfi_def_cfa_offset` directive for functions without stack frame. Reviewers: echristo, rengolin, asl, t.p.northover Reviewed By: t.p.northover Subscribers: llvm-commits, rengolin, aemerson Differential Revision: http://reviews.llvm.org/D8606 llvm-svn: 234399
1 parent 7567a10 commit 3cc62b3

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed
 

‎llvm/lib/Target/ARM/ARMFrameLowering.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ void ARMFrameLowering::emitPrologue(MachineFunction &MF) const {
311311
return;
312312

313313
StackAdjustingInsts DefCFAOffsetCandidates;
314+
bool HasFP = hasFP(MF);
314315

315316
// Allocate the vararg register save area.
316317
if (ArgRegsSaveSize) {
@@ -327,6 +328,7 @@ void ARMFrameLowering::emitPrologue(MachineFunction &MF) const {
327328
DefCFAOffsetCandidates.addInst(std::prev(MBBI),
328329
NumBytes - ArgRegsSaveSize, true);
329330
}
331+
DefCFAOffsetCandidates.emitDefCFAOffsets(MMI, MBB, dl, TII, HasFP);
330332
return;
331333
}
332334

@@ -375,7 +377,6 @@ void ARMFrameLowering::emitPrologue(MachineFunction &MF) const {
375377
}
376378

377379
// Determine starting offsets of spill areas.
378-
bool HasFP = hasFP(MF);
379380
unsigned GPRCS1Offset = NumBytes - ArgRegsSaveSize - GPRCS1Size;
380381
unsigned GPRCS2Offset = GPRCS1Offset - GPRCS2Size;
381382
unsigned DPRAlign = DPRCSSize ? std::min(8U, Align) : 4U;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
; RUN: llc -mtriple=armv7-none-linux-gnueabihf < %s -o - | FileCheck %s
2+
3+
; Function Attrs: nounwind
4+
define void @need_cfi_def_cfa_offset() #0 {
5+
; CHECK-LABEL: need_cfi_def_cfa_offset:
6+
; CHECK: sub sp, sp, #4
7+
; CHECK: .cfi_def_cfa_offset 4
8+
entry:
9+
%Depth = alloca i32, align 4
10+
call void @llvm.dbg.declare(metadata i32* %Depth, metadata !9, metadata !10), !dbg !11
11+
store i32 2, i32* %Depth, align 4, !dbg !11
12+
ret void, !dbg !12
13+
}
14+
15+
; Function Attrs: nounwind readnone
16+
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
17+
18+
attributes #0 = { nounwind }
19+
attributes #1 = { nounwind readnone }
20+
21+
!llvm.dbg.cu = !{!0}
22+
!llvm.module.flags = !{!7, !8}
23+
24+
!0 = !MDCompileUnit(language: DW_LANG_C99, file: !1, producer: "", isOptimized: false)
25+
!1 = !MDFile(filename: "file.c", directory: "/dir")
26+
!2 = !{}
27+
!3 = !MDSubprogram(name: "need_cfi_def_cfa_offset", scope: !1, file: !1, line: 1, type: !4, isLocal: false, isDefinition: true, scopeLine: 2, isOptimized: false, function: void ()* @need_cfi_def_cfa_offset, variables: !2)
28+
!4 = !MDSubroutineType(types: !5)
29+
!5 = !{null}
30+
!6 = !MDBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
31+
!7 = !{i32 2, !"Dwarf Version", i32 4}
32+
!8 = !{i32 2, !"Debug Info Version", i32 3}
33+
!9 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "Depth", scope: !3, file: !1, line: 3, type: !6)
34+
!10 = !MDExpression()
35+
!11 = !MDLocation(line: 3, column: 9, scope: !3)
36+
!12 = !MDLocation(line: 7, column: 5, scope: !3)

0 commit comments

Comments
 (0)
Please sign in to comment.