xref: /llvm-project/llvm/test/DebugInfo/Generic/cu-ranges.ll (revision 5a288fa32e0c91b211e39f3e370255916902f898)
1; RUN: %llc_dwarf -O0 -filetype=obj %s -o %t
2; RUN: llvm-dwarfdump -v %t | FileCheck %s
3
4; Check that we emit ranges for this which has a non-traditional section and a normal section.
5
6; CHECK: DW_TAG_compile_unit
7; CHECK: DW_AT_ranges
8; CHECK: DW_TAG_subprogram
9; CHECK: DW_AT_low_pc
10; CHECK: DW_AT_high_pc
11; CHECK: DW_TAG_subprogram
12; CHECK: DW_AT_low_pc
13; CHECK: DW_AT_high_pc
14
15; CHECK: .debug_ranges contents:
16; FIXME: When we get better dumping facilities we'll want to elaborate here.
17; CHECK: 00000000 <End of list>
18
19; Function Attrs: nounwind uwtable
20define i32 @foo(i32 %a) #0 section "__TEXT,__foo" !dbg !4 {
21entry:
22  %a.addr = alloca i32, align 4
23  store i32 %a, ptr %a.addr, align 4
24  call void @llvm.dbg.declare(metadata ptr %a.addr, metadata !13, metadata !DIExpression()), !dbg !14
25  %0 = load i32, ptr %a.addr, align 4, !dbg !15
26  %add = add nsw i32 %0, 5, !dbg !15
27  ret i32 %add, !dbg !15
28}
29
30; Function Attrs: nounwind readnone
31declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
32
33; Function Attrs: nounwind uwtable
34define i32 @bar(i32 %a) #0 !dbg !9 {
35entry:
36  %a.addr = alloca i32, align 4
37  store i32 %a, ptr %a.addr, align 4
38  call void @llvm.dbg.declare(metadata ptr %a.addr, metadata !16, metadata !DIExpression()), !dbg !17
39  %0 = load i32, ptr %a.addr, align 4, !dbg !18
40  %add = add nsw i32 %0, 5, !dbg !18
41  ret i32 %add, !dbg !18
42}
43
44attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
45attributes #1 = { nounwind readnone }
46
47!llvm.dbg.cu = !{!0}
48!llvm.module.flags = !{!10, !11}
49!llvm.ident = !{!12}
50
51!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.5.0 (trunk 204164) (llvm/trunk 204183)", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
52!1 = !DIFile(filename: "foo.c", directory: "/usr/local/google/home/echristo")
53!2 = !{}
54!4 = distinct !DISubprogram(name: "foo", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 1, file: !1, scope: !5, type: !6, retainedNodes: !2)
55!5 = !DIFile(filename: "foo.c", directory: "/usr/local/google/home/echristo")
56!6 = !DISubroutineType(types: !7)
57!7 = !{!8, !8}
58!8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
59!9 = distinct !DISubprogram(name: "bar", line: 5, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 5, file: !1, scope: !5, type: !6, retainedNodes: !2)
60!10 = !{i32 2, !"Dwarf Version", i32 4}
61!11 = !{i32 1, !"Debug Info Version", i32 3}
62!12 = !{!"clang version 3.5.0 (trunk 204164) (llvm/trunk 204183)"}
63!13 = !DILocalVariable(name: "a", line: 1, arg: 1, scope: !4, file: !5, type: !8)
64!14 = !DILocation(line: 1, scope: !4)
65!15 = !DILocation(line: 2, scope: !4)
66!16 = !DILocalVariable(name: "a", line: 5, arg: 1, scope: !9, file: !5, type: !8)
67!17 = !DILocation(line: 5, scope: !9)
68!18 = !DILocation(line: 6, scope: !9)
69
70