blob: b544ab5c1027f63056a15f963dc6174e1a729df0 [file] [log] [blame]
Keno Fischer6c1e47a2016-02-03 21:13:33 +00001; RUN: llc -filetype=obj -o - < %s | llvm-dwarfdump - | FileCheck %s
2;
3; Created using clang -g -O3 from:
4; struct S0 {
5; short f0;
6; int f3;
7; } a;
8; void fn1(short p1) {
9; struct S0 b, c = {3};
10; b.f3 = p1;
11; a = b = c;
12; }
13;
14; int main() { return 0; }
15;
16; This is similar to the bug in test/DebugInfo/ARM/PR26163.ll, except that there is an
17; extra non-overlapping range first. Thus, we make sure that the backend actually looks
18; at all expressions when determining whether to merge ranges, not just the first one.
19; AS in 26163, we expect two ranges (as opposed to one), the first one being zero sized
20;
21;
Adrian Prantlfb2add22016-02-29 19:49:46 +000022; CHECK: 0x00000025: Beginning address offset: 0x0000000000000004
Keno Fischer6c1e47a2016-02-03 21:13:33 +000023; CHECK: Ending address offset: 0x0000000000000004
Adrian Prantl8fafb8d2016-12-09 20:43:40 +000024; CHECK: Location description: 10 03 93 04 55 93 02
25; constu 0x00000003, piece 0x00000004, rdi, piece 0x00000002
Keno Fischer6c1e47a2016-02-03 21:13:33 +000026; CHECK: Beginning address offset: 0x0000000000000004
27; CHECK: Ending address offset: 0x0000000000000014
Adrian Prantl56527dc2016-11-02 16:12:16 +000028; CHECK: Location description: 10 03 93 04 10 00
29; constu 0x00000003, piece 0x00000004, constu 0x00000000, piece 0x00000004
Keno Fischer6c1e47a2016-02-03 21:13:33 +000030
31target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
32target triple = "x86_64-apple-macosx10.11.0"
33
34%struct.S0 = type { i16, i32 }
35
Peter Collingbourned4135bb2016-09-13 01:12:59 +000036@a = common global %struct.S0 zeroinitializer, align 4, !dbg !21
Keno Fischer6c1e47a2016-02-03 21:13:33 +000037
38declare void @llvm.dbg.declare(metadata, metadata, metadata)
39declare void @llvm.dbg.value(metadata, i64, metadata, metadata)
40
41; The attributes are here to force the zero-sized range not to be at the start of
42; the function, which has special interpretation in DWARF. The fact that this happens
43; at all is probably an LLVM bug.
44attributes #0 = { "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" }
45define void @fn1(i16 signext %p1) #0 !dbg !4 {
46entry:
47 tail call void @llvm.dbg.value(metadata i16 %p1, i64 0, metadata !9, metadata !26), !dbg !27
48 tail call void @llvm.dbg.declare(metadata %struct.S0* undef, metadata !10, metadata !26), !dbg !28
49 tail call void @llvm.dbg.declare(metadata %struct.S0* undef, metadata !16, metadata !26), !dbg !29
50 tail call void @llvm.dbg.value(metadata i32 3, i64 0, metadata !16, metadata !30), !dbg !29
51 tail call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !16, metadata !31), !dbg !29
52 tail call void @llvm.dbg.value(metadata i16 %p1, i64 0, metadata !10, metadata !32), !dbg !28
53 tail call void @llvm.dbg.value(metadata i32 3, i64 0, metadata !10, metadata !30), !dbg !28
54 tail call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !10, metadata !31), !dbg !28
55 store i32 3, i32* bitcast (%struct.S0* @a to i32*), align 4, !dbg !33
56 store i32 0, i32* getelementptr inbounds (%struct.S0, %struct.S0* @a, i64 0, i32 1), align 4, !dbg !33
57 ret void, !dbg !34
58}
59
60define i32 @main() !dbg !17 {
61entry:
62 ret i32 0, !dbg !35
63}
64
65!llvm.dbg.cu = !{!0}
66!llvm.module.flags = !{!22, !23, !24}
67!llvm.ident = !{!25}
68
Adrian Prantl75819ae2016-04-15 15:57:41 +000069!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.9.0 (https://github.com/llvm-mirror/clang 8f258397c5afd7a708bd95770c718e81d08fb11a) (https://github.com/llvm-mirror/llvm 18481855bdfa1b4a424f81be8525db002671348d)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, globals: !20)
Keno Fischer6c1e47a2016-02-03 21:13:33 +000070!1 = !DIFile(filename: "small.c", directory: "/Users/kfischer/Projects/clangbug")
71!2 = !{}
Adrian Prantl75819ae2016-04-15 15:57:41 +000072!4 = distinct !DISubprogram(name: "fn1", scope: !1, file: !1, line: 5, type: !5, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !8)
Keno Fischer6c1e47a2016-02-03 21:13:33 +000073!5 = !DISubroutineType(types: !6)
74!6 = !{null, !7}
75!7 = !DIBasicType(name: "short", size: 16, align: 16, encoding: DW_ATE_signed)
76!8 = !{!9, !10, !16}
77!9 = !DILocalVariable(name: "p1", arg: 1, scope: !4, file: !1, line: 5, type: !7)
78!10 = !DILocalVariable(name: "b", scope: !4, file: !1, line: 6, type: !11)
79!11 = !DICompositeType(tag: DW_TAG_structure_type, name: "S0", file: !1, line: 1, size: 64, align: 32, elements: !12)
80!12 = !{!13, !14}
81!13 = !DIDerivedType(tag: DW_TAG_member, name: "f0", scope: !11, file: !1, line: 2, baseType: !7, size: 16, align: 16)
82!14 = !DIDerivedType(tag: DW_TAG_member, name: "f3", scope: !11, file: !1, line: 3, baseType: !15, size: 32, align: 32, offset: 32)
83!15 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
84!16 = !DILocalVariable(name: "c", scope: !4, file: !1, line: 6, type: !11)
Adrian Prantl75819ae2016-04-15 15:57:41 +000085!17 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 11, type: !18, isLocal: false, isDefinition: true, scopeLine: 11, isOptimized: true, unit: !0, variables: !2)
Keno Fischer6c1e47a2016-02-03 21:13:33 +000086!18 = !DISubroutineType(types: !19)
87!19 = !{!15}
88!20 = !{!21}
Peter Collingbourned4135bb2016-09-13 01:12:59 +000089!21 = !DIGlobalVariable(name: "a", scope: !0, file: !1, line: 4, type: !11, isLocal: false, isDefinition: true)
Keno Fischer6c1e47a2016-02-03 21:13:33 +000090!22 = !{i32 2, !"Dwarf Version", i32 2}
91!23 = !{i32 2, !"Debug Info Version", i32 3}
92!24 = !{i32 1, !"PIC Level", i32 2}
93!25 = !{!"clang version 3.9.0 (https://github.com/llvm-mirror/clang 8f258397c5afd7a708bd95770c718e81d08fb11a) (https://github.com/llvm-mirror/llvm 18481855bdfa1b4a424f81be8525db002671348d)"}
94!26 = !DIExpression()
95!27 = !DILocation(line: 5, column: 16, scope: !4)
96!28 = !DILocation(line: 6, column: 13, scope: !4)
97!29 = !DILocation(line: 6, column: 16, scope: !4)
Adrian Prantl941fa752016-12-05 18:04:47 +000098!30 = !DIExpression(DW_OP_LLVM_fragment, 0, 32)
99!31 = !DIExpression(DW_OP_LLVM_fragment, 32, 32)
100!32 = !DIExpression(DW_OP_LLVM_fragment, 32, 16)
Keno Fischer6c1e47a2016-02-03 21:13:33 +0000101!33 = !DILocation(line: 8, column: 9, scope: !4)
102!34 = !DILocation(line: 9, column: 1, scope: !4)
103!35 = !DILocation(line: 11, column: 14, scope: !17)