1# Verify that a CFI instruction with no debug location
2# does not result in a line-0 location in the assembler.
3# RUN: %llc_dwarf -start-after=prologepilog -march=x86-64 -use-unknown-locations=Enable %s -o - | FileCheck %s
4#
5# CHECK-NOT: .loc 1 0
6# CHECK:     .cfi_def_cfa_offset
7# UNSUPPORTED: cygwin,mingw32,win32,x86_64-pc-windows-gnu
8
9--- |
10  ; ModuleID = 'no-cfi-loc.ll'
11  source_filename = "no-cfi-loc.ll"
12  target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
13
14  define void @foo() !dbg !6 {
15  entry:
16    call void @bar(), !dbg !8
17    ret void, !dbg !9
18  }
19
20  declare void @bar()
21
22  ; Function Attrs: nounwind
23  declare void @llvm.stackprotector(i8*, i8**) #0
24
25  attributes #0 = { nounwind }
26
27  !llvm.dbg.cu = !{!0}
28  !llvm.module.flags = !{!3, !4}
29  !llvm.ident = !{!5}
30
31  !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 4.0.0 (trunk 288778)", isOptimized: false, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2)
32  !1 = !DIFile(filename: "t.c", directory: "/home/probinson/projects/scratch")
33  !2 = !{}
34  !3 = !{i32 2, !"Dwarf Version", i32 4}
35  !4 = !{i32 2, !"Debug Info Version", i32 3}
36  !5 = !{!"clang version 4.0.0 (trunk 288778)"}
37  !6 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 2, type: !7, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
38  !7 = !DISubroutineType(types: !2)
39  !8 = !DILocation(line: 3, column: 2, scope: !6)
40  !9 = !DILocation(line: 4, column: 1, scope: !6)
41
42...
43---
44name:            foo
45alignment:       4
46exposesReturnsTwice: false
47legalized:       false
48regBankSelected: false
49selected:        false
50tracksRegLiveness: true
51calleeSavedRegisters: [ '$bh', '$bl', '$bp', '$bpl', '$bx', '$ebp', '$ebx',
52                        '$rbp', '$rbx', '$r12', '$r13', '$r14', '$r15',
53                        '$r12b', '$r13b', '$r14b', '$r15b', '$r12d', '$r13d',
54                        '$r14d', '$r15d', '$r12w', '$r13w', '$r14w', '$r15w' ]
55frameInfo:
56  isFrameAddressTaken: false
57  isReturnAddressTaken: false
58  hasStackMap:     false
59  hasPatchPoint:   false
60  stackSize:       8
61  offsetAdjustment: 0
62  maxAlignment:    0
63  adjustsStack:    true
64  hasCalls:        true
65  maxCallFrameSize: 0
66  hasOpaqueSPAdjustment: false
67  hasVAStart:      false
68  hasMustTailInVarArgFunc: false
69body:             |
70  bb.0.entry:
71    frame-setup PUSH64r undef $rax, implicit-def $rsp, implicit $rsp, debug-location !8
72    CFI_INSTRUCTION def_cfa_offset 16
73    CALL64pcrel32 @bar, csr_64, implicit $rsp, implicit-def $rsp, debug-location !8
74    $rax = POP64r implicit-def $rsp, implicit $rsp, debug-location !9
75    RET 0, debug-location !9
76
77...
78