xref: /llvm-project/llvm/test/DebugInfo/X86/stack-value-piece-inseltpoison.ll (revision 3036547248966a7cfc376eed41a0d2d1e9014348)
1*30365472SJuneyoung Lee; RUN: llc %s -filetype=obj -o - | llvm-dwarfdump -debug-info -debug-loc - | FileCheck %s
2*30365472SJuneyoung Lee; Test that DW_OP_piece is emitted for constants.
3*30365472SJuneyoung Lee;
4*30365472SJuneyoung Lee; // Generated from:
5*30365472SJuneyoung Lee; typedef struct { int a, b; } I;
6*30365472SJuneyoung Lee; I i(int i) {
7*30365472SJuneyoung Lee;   I r = {i, 0};
8*30365472SJuneyoung Lee;   return r;
9*30365472SJuneyoung Lee; }
10*30365472SJuneyoung Lee;
11*30365472SJuneyoung Lee; typedef struct { float a, b; } F;
12*30365472SJuneyoung Lee; F f(float f) {
13*30365472SJuneyoung Lee;   F r = {f, 0};
14*30365472SJuneyoung Lee;   return r;
15*30365472SJuneyoung Lee; }
16*30365472SJuneyoung Lee
17*30365472SJuneyoung Lee; CHECK: .debug_info contents:
18*30365472SJuneyoung Lee; CHECK: DW_TAG_subprogram
19*30365472SJuneyoung Lee; CHECK:   DW_AT_name ("i")
20*30365472SJuneyoung Lee; CHECK:   DW_TAG_variable
21*30365472SJuneyoung Lee; CHECK-NEXT:   DW_AT_location ([[I:0x[0-9a-f]+]]
22*30365472SJuneyoung Lee; CHECK-NEXT:     [{{.*}}, {{.*}}): DW_OP_reg5 RDI, DW_OP_piece 0x4, DW_OP_lit0, DW_OP_stack_value, DW_OP_piece 0x4)
23*30365472SJuneyoung Lee; CHECK-NEXT:   DW_AT_name ("r")
24*30365472SJuneyoung Lee;
25*30365472SJuneyoung Lee; CHECK: DW_TAG_subprogram
26*30365472SJuneyoung Lee; CHECK:   DW_AT_name ("f")
27*30365472SJuneyoung Lee; CHECK:   DW_TAG_variable
28*30365472SJuneyoung Lee; CHECK-NEXT:   DW_AT_location ([[F:0x[0-9a-f]+]]
29*30365472SJuneyoung Lee; CHECK-NEXT:     [{{.*}}, {{.*}}): DW_OP_reg17 XMM0, DW_OP_piece 0x4, {{(DW_OP_lit0, DW_OP_stack_value, DW_OP_piece 0x4|DW_OP_implicit_value 0x4 0x00 0x00 0x00 0x00)}}
30*30365472SJuneyoung Lee; CHECK-NEXT:     [{{.*}}, {{.*}}): DW_OP_piece 0x4, {{(DW_OP_lit0, DW_OP_stack_value, DW_OP_piece 0x4|DW_OP_implicit_value 0x4 0x00 0x00 0x00 0x00)}})
31*30365472SJuneyoung Lee; CHECK-NEXT:   DW_AT_name ("r")
32*30365472SJuneyoung Lee;
33*30365472SJuneyoung Lee; CHECK: .debug_loc contents:
34*30365472SJuneyoung Lee; CHECK:      [[I]]:
35*30365472SJuneyoung Lee; CHECK-NEXT:   ({{.*}}, {{.*}}): DW_OP_reg5 RDI, DW_OP_piece 0x4, DW_OP_lit0, DW_OP_stack_value, DW_OP_piece 0x4
36*30365472SJuneyoung Lee; CHECK:      [[F]]:
37*30365472SJuneyoung Lee; CHECK-NEXT:   ({{.*}}, {{.*}}): DW_OP_reg17 XMM0, DW_OP_piece 0x4, {{DW_OP_lit0, DW_OP_stack_value, DW_OP_piece 0x4|DW_OP_implicit_value 0x4 0x00 0x00 0x00 0x00}}
38*30365472SJuneyoung Lee
39*30365472SJuneyoung Leesource_filename = "stack-value-piece.c"
40*30365472SJuneyoung Leetarget datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
41*30365472SJuneyoung Leetarget triple = "x86_64-apple-macosx10.12.0"
42*30365472SJuneyoung Lee
43*30365472SJuneyoung Lee%struct.I = type { i32, i32 }
44*30365472SJuneyoung Lee%struct.F = type { float, float }
45*30365472SJuneyoung Lee
46*30365472SJuneyoung Lee; Function Attrs: nounwind readnone ssp uwtable
47*30365472SJuneyoung Leedefine i64 @i(i32 %i) local_unnamed_addr #0 !dbg !7 {
48*30365472SJuneyoung Leeentry:
49*30365472SJuneyoung Lee  tail call void @llvm.dbg.value(metadata i32 %i, metadata !18, metadata !22), !dbg !21
50*30365472SJuneyoung Lee  tail call void @llvm.dbg.value(metadata i32 0, metadata !18, metadata !23), !dbg !21
51*30365472SJuneyoung Lee  %retval.sroa.0.0.insert.ext = zext i32 %i to i64, !dbg !24
52*30365472SJuneyoung Lee  ret i64 %retval.sroa.0.0.insert.ext, !dbg !24
53*30365472SJuneyoung Lee}
54*30365472SJuneyoung Lee
55*30365472SJuneyoung Lee; Function Attrs: nounwind readnone
56*30365472SJuneyoung Leedeclare void @llvm.dbg.declare(metadata, metadata, metadata) #1
57*30365472SJuneyoung Lee
58*30365472SJuneyoung Lee; Function Attrs: nounwind readnone ssp uwtable
59*30365472SJuneyoung Leedefine <2 x float> @f(float %f) local_unnamed_addr #0 !dbg !25 {
60*30365472SJuneyoung Leeentry:
61*30365472SJuneyoung Lee  tail call void @llvm.dbg.value(metadata float %f, metadata !36, metadata !22), !dbg !38
62*30365472SJuneyoung Lee  tail call void @llvm.dbg.value(metadata float 0.000000e+00, metadata !36, metadata !23), !dbg !38
63*30365472SJuneyoung Lee  %retval.sroa.0.0.vec.insert = insertelement <2 x float> poison, float %f, i32 0, !dbg !39
64*30365472SJuneyoung Lee  %retval.sroa.0.4.vec.insert = insertelement <2 x float> %retval.sroa.0.0.vec.insert, float 0.000000e+00, i32 1, !dbg !39
65*30365472SJuneyoung Lee  ret <2 x float> %retval.sroa.0.4.vec.insert, !dbg !40
66*30365472SJuneyoung Lee}
67*30365472SJuneyoung Lee
68*30365472SJuneyoung Lee; Function Attrs: nounwind readnone
69*30365472SJuneyoung Leedeclare void @llvm.dbg.value(metadata, metadata, metadata) #1
70*30365472SJuneyoung Lee
71*30365472SJuneyoung Leeattributes #0 = { nounwind readnone ssp uwtable }
72*30365472SJuneyoung Leeattributes #1 = { nounwind readnone }
73*30365472SJuneyoung Lee
74*30365472SJuneyoung Lee!llvm.dbg.cu = !{!0}
75*30365472SJuneyoung Lee!llvm.module.flags = !{!3, !4, !5}
76*30365472SJuneyoung Lee!llvm.ident = !{!6}
77*30365472SJuneyoung Lee
78*30365472SJuneyoung Lee!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)
79*30365472SJuneyoung Lee!1 = !DIFile(filename: "stack-value-piece.c", directory: "/")
80*30365472SJuneyoung Lee!2 = !{}
81*30365472SJuneyoung Lee!3 = !{i32 2, !"Dwarf Version", i32 4}
82*30365472SJuneyoung Lee!4 = !{i32 2, !"Debug Info Version", i32 3}
83*30365472SJuneyoung Lee!5 = !{i32 1, !"PIC Level", i32 2}
84*30365472SJuneyoung Lee!6 = !{!"clang version 4.0.0 (trunk 285655) (llvm/trunk 285654)"}
85*30365472SJuneyoung Lee!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)
86*30365472SJuneyoung Lee!8 = !DISubroutineType(types: !9)
87*30365472SJuneyoung Lee!9 = !{!10, !14}
88*30365472SJuneyoung Lee!10 = !DIDerivedType(tag: DW_TAG_typedef, name: "I", file: !1, line: 1, baseType: !11)
89*30365472SJuneyoung Lee!11 = distinct !DICompositeType(tag: DW_TAG_structure_type, file: !1, line: 1, size: 64, elements: !12)
90*30365472SJuneyoung Lee!12 = !{!13, !15}
91*30365472SJuneyoung Lee!13 = !DIDerivedType(tag: DW_TAG_member, name: "a", scope: !11, file: !1, line: 1, baseType: !14, size: 32)
92*30365472SJuneyoung Lee!14 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
93*30365472SJuneyoung Lee!15 = !DIDerivedType(tag: DW_TAG_member, name: "b", scope: !11, file: !1, line: 1, baseType: !14, size: 32, offset: 32)
94*30365472SJuneyoung Lee!18 = !DILocalVariable(name: "r", scope: !7, file: !1, line: 3, type: !10)
95*30365472SJuneyoung Lee!19 = !DIExpression()
96*30365472SJuneyoung Lee!20 = !DILocation(line: 2, column: 9, scope: !7)
97*30365472SJuneyoung Lee!21 = !DILocation(line: 3, column: 5, scope: !7)
98*30365472SJuneyoung Lee!22 = !DIExpression(DW_OP_LLVM_fragment, 0, 32)
99*30365472SJuneyoung Lee!23 = !DIExpression(DW_OP_LLVM_fragment, 32, 32)
100*30365472SJuneyoung Lee!24 = !DILocation(line: 5, column: 1, scope: !7)
101*30365472SJuneyoung Lee!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)
102*30365472SJuneyoung Lee!26 = !DISubroutineType(types: !27)
103*30365472SJuneyoung Lee!27 = !{!28, !32}
104*30365472SJuneyoung Lee!28 = !DIDerivedType(tag: DW_TAG_typedef, name: "F", file: !1, line: 7, baseType: !29)
105*30365472SJuneyoung Lee!29 = distinct !DICompositeType(tag: DW_TAG_structure_type, file: !1, line: 7, size: 64, elements: !30)
106*30365472SJuneyoung Lee!30 = !{!31, !33}
107*30365472SJuneyoung Lee!31 = !DIDerivedType(tag: DW_TAG_member, name: "a", scope: !29, file: !1, line: 7, baseType: !32, size: 32)
108*30365472SJuneyoung Lee!32 = !DIBasicType(name: "float", size: 32, encoding: DW_ATE_float)
109*30365472SJuneyoung Lee!33 = !DIDerivedType(tag: DW_TAG_member, name: "b", scope: !29, file: !1, line: 7, baseType: !32, size: 32, offset: 32)
110*30365472SJuneyoung Lee!36 = !DILocalVariable(name: "r", scope: !25, file: !1, line: 9, type: !28)
111*30365472SJuneyoung Lee!37 = !DILocation(line: 8, column: 11, scope: !25)
112*30365472SJuneyoung Lee!38 = !DILocation(line: 9, column: 5, scope: !25)
113*30365472SJuneyoung Lee!39 = !DILocation(line: 10, column: 10, scope: !25)
114*30365472SJuneyoung Lee!40 = !DILocation(line: 11, column: 1, scope: !25)
115