blob: 65c1cfb07e64d355f1f814a2d34e5fb7ca582e3d [file] [log] [blame]
Adrian Prantl56527dc2016-11-02 16:12:16 +00001; RUN: llc %s -filetype=obj -o - | llvm-dwarfdump - | FileCheck %s
2; Test that DW_OP_piece is emitted for constants.
3;
4; // Generated from:
5; typedef struct { int a, b; } I;
6; I i(int i) {
7; I r = {i, 0};
8; return r;
9; }
10;
11; typedef struct { float a, b; } F;
12; F f(float f) {
13; F r = {f, 0};
14; return r;
15; }
16
17; CHECK: .debug_info contents:
18; CHECK: DW_TAG_subprogram
19; CHECK: DW_AT_name {{.*}} "i"
20; CHECK: DW_TAG_variable
21; CHECK-NEXT: DW_AT_location {{.*}} ([[I:.*]])
22; CHECK-NEXT: DW_AT_name {{.*}} "r"
23;
24; CHECK: DW_TAG_subprogram
25; CHECK: DW_AT_name {{.*}} "f"
26; CHECK: DW_TAG_variable
27; CHECK-NEXT: DW_AT_location {{.*}} ([[F:.*]])
28; CHECK-NEXT: DW_AT_name {{.*}} "r"
29;
30; CHECK: .debug_loc contents:
31; CHECK: [[I]]: Beginning address offset:
32; CHECK-NEXT: Ending address offset:
33; CHECK-NEXT: Location description: 55 93 04 10 00 9f 93 04
34; rdi, piece 0x00000004, constu 0x00000000, stack-value, piece 0x00000004
35;
36; CHECK: [[F]]: Beginning address offset:
37; CHECK-NEXT: Ending address offset:
38; CHECK-NEXT: Location description: 61 93 04 10 00 9f 93 04
39; reg17, piece 0x00000004, constu 0x00000000, stack-value, piece 0x00000004
40
41source_filename = "stack-value-piece.c"
42target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
43target triple = "x86_64-apple-macosx10.12.0"
44
45%struct.I = type { i32, i32 }
46%struct.F = type { float, float }
47
48; Function Attrs: nounwind readnone ssp uwtable
49define i64 @i(i32 %i) local_unnamed_addr #0 !dbg !7 {
50entry:
51 tail call void @llvm.dbg.value(metadata i32 %i, i64 0, metadata !18, metadata !22), !dbg !21
52 tail call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !18, metadata !23), !dbg !21
53 %retval.sroa.0.0.insert.ext = zext i32 %i to i64, !dbg !24
54 ret i64 %retval.sroa.0.0.insert.ext, !dbg !24
55}
56
57; Function Attrs: nounwind readnone
58declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
59
60; Function Attrs: nounwind readnone ssp uwtable
61define <2 x float> @f(float %f) local_unnamed_addr #0 !dbg !25 {
62entry:
63 tail call void @llvm.dbg.value(metadata float %f, i64 0, metadata !36, metadata !22), !dbg !38
64 tail call void @llvm.dbg.value(metadata float 0.000000e+00, i64 0, metadata !36, metadata !23), !dbg !38
65 %retval.sroa.0.0.vec.insert = insertelement <2 x float> undef, float %f, i32 0, !dbg !39
66 %retval.sroa.0.4.vec.insert = insertelement <2 x float> %retval.sroa.0.0.vec.insert, float 0.000000e+00, i32 1, !dbg !39
67 ret <2 x float> %retval.sroa.0.4.vec.insert, !dbg !40
68}
69
70; Function Attrs: nounwind readnone
71declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #1
72
73attributes #0 = { nounwind readnone ssp uwtable }
74attributes #1 = { nounwind readnone }
75
76!llvm.dbg.cu = !{!0}
77!llvm.module.flags = !{!3, !4, !5}
78!llvm.ident = !{!6}
79
80!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 4.0.0 (trunk 285655) (llvm/trunk 285654)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
81!1 = !DIFile(filename: "stack-value-piece.c", directory: "/")
82!2 = !{}
83!3 = !{i32 2, !"Dwarf Version", i32 4}
84!4 = !{i32 2, !"Debug Info Version", i32 3}
85!5 = !{i32 1, !"PIC Level", i32 2}
86!6 = !{!"clang version 4.0.0 (trunk 285655) (llvm/trunk 285654)"}
87!7 = distinct !DISubprogram(name: "i", scope: !1, file: !1, line: 2, type: !8, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true, unit: !0)
88!8 = !DISubroutineType(types: !9)
89!9 = !{!10, !14}
90!10 = !DIDerivedType(tag: DW_TAG_typedef, name: "I", file: !1, line: 1, baseType: !11)
91!11 = distinct !DICompositeType(tag: DW_TAG_structure_type, file: !1, line: 1, size: 64, elements: !12)
92!12 = !{!13, !15}
93!13 = !DIDerivedType(tag: DW_TAG_member, name: "a", scope: !11, file: !1, line: 1, baseType: !14, size: 32)
94!14 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
95!15 = !DIDerivedType(tag: DW_TAG_member, name: "b", scope: !11, file: !1, line: 1, baseType: !14, size: 32, offset: 32)
96!18 = !DILocalVariable(name: "r", scope: !7, file: !1, line: 3, type: !10)
97!19 = !DIExpression()
98!20 = !DILocation(line: 2, column: 9, scope: !7)
99!21 = !DILocation(line: 3, column: 5, scope: !7)
Adrian Prantl941fa752016-12-05 18:04:47 +0000100!22 = !DIExpression(DW_OP_LLVM_fragment, 0, 32)
101!23 = !DIExpression(DW_OP_LLVM_fragment, 32, 32)
Adrian Prantl56527dc2016-11-02 16:12:16 +0000102!24 = !DILocation(line: 5, column: 1, scope: !7)
103!25 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 8, type: !26, isLocal: false, isDefinition: true, scopeLine: 8, flags: DIFlagPrototyped, isOptimized: true, unit: !0)
104!26 = !DISubroutineType(types: !27)
105!27 = !{!28, !32}
106!28 = !DIDerivedType(tag: DW_TAG_typedef, name: "F", file: !1, line: 7, baseType: !29)
107!29 = distinct !DICompositeType(tag: DW_TAG_structure_type, file: !1, line: 7, size: 64, elements: !30)
108!30 = !{!31, !33}
109!31 = !DIDerivedType(tag: DW_TAG_member, name: "a", scope: !29, file: !1, line: 7, baseType: !32, size: 32)
110!32 = !DIBasicType(name: "float", size: 32, encoding: DW_ATE_float)
111!33 = !DIDerivedType(tag: DW_TAG_member, name: "b", scope: !29, file: !1, line: 7, baseType: !32, size: 32, offset: 32)
112!36 = !DILocalVariable(name: "r", scope: !25, file: !1, line: 9, type: !28)
113!37 = !DILocation(line: 8, column: 11, scope: !25)
114!38 = !DILocation(line: 9, column: 5, scope: !25)
115!39 = !DILocation(line: 10, column: 10, scope: !25)
116!40 = !DILocation(line: 11, column: 1, scope: !25)