1 ; REQUIRES: object-emission
3 ; RUN: llvm-link %s %p/type-unique-type-array-b.ll -S -o - | %llc_dwarf -filetype=obj -O0 | llvm-dwarfdump -v -debug-info - | FileCheck %s
5 ; rdar://problem/17628609
14 ; 7 void testA(SA a) {
18 ; 11 void topA(A *a, SA sa) {
22 ; CHECK: DW_TAG_compile_unit
23 ; CHECK: DW_TAG_class_type
24 ; CHECK-NEXT: DW_AT_name {{.*}}"A"
25 ; CHECK: DW_TAG_subprogram
26 ; CHECK: DW_AT_name {{.*}}"testA"
27 ; CHECK: DW_TAG_formal_parameter
28 ; CHECK: DW_TAG_formal_parameter
29 ; CHECK-NEXT: DW_AT_type [DW_FORM_ref4] (cu + 0x{{.*}} => {0x[[STRUCT:.*]]}
30 ; CHECK: 0x[[STRUCT]]: DW_TAG_structure_type
31 ; CHECK-NEXT: DW_AT_name {{.*}}"SA"
33 ; CHECK: DW_TAG_compile_unit
34 ; CHECK: DW_TAG_class_type
35 ; CHECK-NEXT: DW_AT_name {{.*}}"B"
36 ; CHECK: DW_TAG_subprogram
37 ; CHECK: DW_AT_name {{.*}}"testB"
38 ; CHECK: DW_TAG_formal_parameter
39 ; CHECK: DW_TAG_formal_parameter
40 ; CHECK-NEXT: DW_AT_type [DW_FORM_ref_addr] {{.*}}[[STRUCT]]
42 %class.A = type { i8 }
43 %struct.SA = type { i32 }
45 ; Function Attrs: ssp uwtable
46 define void @_Z4topAP1A2SA(ptr %a, i32 %sa.coerce) #0 !dbg !15 {
48 %sa = alloca %struct.SA, align 4
49 %a.addr = alloca ptr, align 8
50 %agg.tmp = alloca %struct.SA, align 4
51 store i32 %sa.coerce, ptr %sa
52 store ptr %a, ptr %a.addr, align 8
53 call void @llvm.dbg.declare(metadata ptr %a.addr, metadata !24, metadata !DIExpression()), !dbg !25
54 call void @llvm.dbg.declare(metadata ptr %sa, metadata !26, metadata !DIExpression()), !dbg !27
55 %0 = load ptr, ptr %a.addr, align 8, !dbg !28
56 call void @llvm.memcpy.p0.p0.i64(ptr align 4 %agg.tmp, ptr align 4 %sa, i64 4, i1 false), !dbg !28
57 %1 = load i32, ptr %agg.tmp, !dbg !28
58 call void @_ZN1A5testAE2SA(ptr %0, i32 %1), !dbg !28
62 ; Function Attrs: nounwind readnone
63 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
65 ; Function Attrs: nounwind ssp uwtable
66 define linkonce_odr void @_ZN1A5testAE2SA(ptr %this, i32 %a.coerce) #2 align 2 !dbg !20 {
68 %a = alloca %struct.SA, align 4
69 %this.addr = alloca ptr, align 8
70 store i32 %a.coerce, ptr %a
71 store ptr %this, ptr %this.addr, align 8
72 call void @llvm.dbg.declare(metadata ptr %this.addr, metadata !30, metadata !DIExpression()), !dbg !31
73 call void @llvm.dbg.declare(metadata ptr %a, metadata !32, metadata !DIExpression()), !dbg !33
74 %this1 = load ptr, ptr %this.addr
78 ; Function Attrs: nounwind
79 declare void @llvm.memcpy.p0.p0.i64(ptr nocapture, ptr nocapture readonly, i64, i1) #3
81 attributes #0 = { ssp 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" }
82 attributes #1 = { nounwind readnone }
83 attributes #2 = { nounwind ssp 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" }
84 attributes #3 = { nounwind }
87 !llvm.module.flags = !{!21, !22}
90 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 (trunk 214102:214113M) (llvm/trunk 214102:214115M)", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !3, globals: !2, imports: !2)
91 !1 = !DIFile(filename: "a.cpp", directory: "/Users/manmanren/test-Nov/type_unique/rdar_di_array")
94 !4 = !DICompositeType(tag: DW_TAG_class_type, name: "A", line: 5, file: !1, elements: !5, identifier: "_ZTS1A")
96 !6 = !DISubprogram(name: "testA", linkageName: "_ZN1A5testAE2SA", line: 7, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 7, file: !1, scope: !4, type: !7)
97 !7 = !DISubroutineType(types: !8)
99 !9 = !DIDerivedType(tag: DW_TAG_pointer_type, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !4)
100 !10 = !DICompositeType(tag: DW_TAG_structure_type, name: "SA", line: 1, size: 32, align: 32, file: !1, elements: !11, identifier: "_ZTS2SA")
102 !12 = !DIDerivedType(tag: DW_TAG_member, name: "a", line: 2, size: 32, align: 32, file: !1, scope: !10, baseType: !13)
103 !13 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
104 !15 = distinct !DISubprogram(name: "topA", linkageName: "_Z4topAP1A2SA", line: 11, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 11, file: !1, scope: !16, type: !17, retainedNodes: !2)
105 !16 = !DIFile(filename: "a.cpp", directory: "/Users/manmanren/test-Nov/type_unique/rdar_di_array")
106 !17 = !DISubroutineType(types: !18)
107 !18 = !{null, !19, !10}
108 !19 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !4)
109 !20 = distinct !DISubprogram(name: "testA", linkageName: "_ZN1A5testAE2SA", line: 7, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 7, file: !1, scope: !4, type: !7, declaration: !6, retainedNodes: !2)
110 !21 = !{i32 2, !"Dwarf Version", i32 3}
111 !22 = !{i32 2, !"Debug Info Version", i32 3}
112 !23 = !{!"clang version 3.5.0 (trunk 214102:214113M) (llvm/trunk 214102:214115M)"}
113 !24 = !DILocalVariable(name: "a", line: 11, arg: 1, scope: !15, file: !16, type: !19)
114 !25 = !DILocation(line: 11, column: 14, scope: !15)
115 !26 = !DILocalVariable(name: "sa", line: 11, arg: 2, scope: !15, file: !16, type: !10)
116 !27 = !DILocation(line: 11, column: 20, scope: !15)
117 !28 = !DILocation(line: 12, column: 3, scope: !15)
118 !29 = !DILocation(line: 13, column: 1, scope: !15)
119 !30 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !20, type: !19)
120 !31 = !DILocation(line: 0, scope: !20)
121 !32 = !DILocalVariable(name: "a", line: 7, arg: 2, scope: !20, file: !16, type: !10)
122 !33 = !DILocation(line: 7, column: 17, scope: !20)
123 !34 = !DILocation(line: 8, column: 3, scope: !20)