xref: /llvm-project/llvm/test/Linker/type-unique-type-array-b.ll (revision f2e868c566107eb2f54e3e6033199297ba11e2d9)
1; RUN: true
2; This file belongs to type-unique-type-array-a.ll.
3;
4; rdar://problem/17628609
5;
6; cat -n b.cpp
7;     1	struct SA {
8;     2	  int a;
9;     3	};
10;     4
11;     5	class B {
12;     6	public:
13;     7	  void testB(SA sa) {
14;     8	  }
15;     9	};
16;    10
17;    11	void topB(B* b, SA sa) {
18;    12	  b->testB(sa);
19;    13	}
20
21%class.B = type { i8 }
22%struct.SA = type { i32 }
23
24; Function Attrs: ssp uwtable
25define void @_Z4topBP1B2SA(ptr %b, i32 %sa.coerce) #0 !dbg !15 {
26entry:
27  %sa = alloca %struct.SA, align 4
28  %b.addr = alloca ptr, align 8
29  %agg.tmp = alloca %struct.SA, align 4
30  store i32 %sa.coerce, ptr %sa
31  store ptr %b, ptr %b.addr, align 8
32  call void @llvm.dbg.declare(metadata ptr %b.addr, metadata !24, metadata !DIExpression()), !dbg !25
33  call void @llvm.dbg.declare(metadata ptr %sa, metadata !26, metadata !DIExpression()), !dbg !27
34  %0 = load ptr, ptr %b.addr, align 8, !dbg !28
35  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %agg.tmp, ptr align 4 %sa, i64 4, i1 false), !dbg !28
36  %1 = load i32, ptr %agg.tmp, !dbg !28
37  call void @_ZN1B5testBE2SA(ptr %0, i32 %1), !dbg !28
38  ret void, !dbg !29
39}
40
41; Function Attrs: nounwind readnone
42declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
43
44; Function Attrs: nounwind ssp uwtable
45define linkonce_odr void @_ZN1B5testBE2SA(ptr %this, i32 %sa.coerce) #2 align 2 !dbg !20 {
46entry:
47  %sa = alloca %struct.SA, align 4
48  %this.addr = alloca ptr, align 8
49  store i32 %sa.coerce, ptr %sa
50  store ptr %this, ptr %this.addr, align 8
51  call void @llvm.dbg.declare(metadata ptr %this.addr, metadata !30, metadata !DIExpression()), !dbg !31
52  call void @llvm.dbg.declare(metadata ptr %sa, metadata !32, metadata !DIExpression()), !dbg !33
53  %this1 = load ptr, ptr %this.addr
54  ret void, !dbg !34
55}
56
57; Function Attrs: nounwind
58declare void @llvm.memcpy.p0.p0.i64(ptr nocapture, ptr nocapture readonly, i64, i1) #3
59
60attributes #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" }
61attributes #1 = { nounwind readnone }
62attributes #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" }
63attributes #3 = { nounwind }
64
65!llvm.dbg.cu = !{!0}
66!llvm.module.flags = !{!21, !22}
67!llvm.ident = !{!23}
68
69!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)
70!1 = !DIFile(filename: "b.cpp", directory: "/Users/manmanren/test-Nov/type_unique/rdar_di_array")
71!2 = !{}
72!3 = !{!4, !10}
73!4 = !DICompositeType(tag: DW_TAG_class_type, name: "B", line: 5, file: !1, elements: !5, identifier: "_ZTS1B")
74!5 = !{!6}
75!6 = !DISubprogram(name: "testB", linkageName: "_ZN1B5testBE2SA", line: 7, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 7, file: !1, scope: !4, type: !7)
76!7 = !DISubroutineType(types: !8)
77!8 = !{null, !9, !10}
78!9 = !DIDerivedType(tag: DW_TAG_pointer_type, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !4)
79!10 = !DICompositeType(tag: DW_TAG_structure_type, name: "SA", line: 1, size: 32, align: 32, file: !1, elements: !11, identifier: "_ZTS2SA")
80!11 = !{!12}
81!12 = !DIDerivedType(tag: DW_TAG_member, name: "a", line: 2, size: 32, align: 32, file: !1, scope: !10, baseType: !13)
82!13 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
83!15 = distinct !DISubprogram(name: "topB", linkageName: "_Z4topBP1B2SA", line: 11, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 11, file: !1, scope: !16, type: !17, retainedNodes: !2)
84!16 = !DIFile(filename: "b.cpp", directory: "/Users/manmanren/test-Nov/type_unique/rdar_di_array")
85!17 = !DISubroutineType(types: !18)
86!18 = !{null, !19, !10}
87!19 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !4)
88!20 = distinct !DISubprogram(name: "testB", linkageName: "_ZN1B5testBE2SA", 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)
89!21 = !{i32 2, !"Dwarf Version", i32 3}
90!22 = !{i32 2, !"Debug Info Version", i32 3}
91!23 = !{!"clang version 3.5.0 (trunk 214102:214113M) (llvm/trunk 214102:214115M)"}
92!24 = !DILocalVariable(name: "b", line: 11, arg: 1, scope: !15, file: !16, type: !19)
93!25 = !DILocation(line: 11, column: 14, scope: !15)
94!26 = !DILocalVariable(name: "sa", line: 11, arg: 2, scope: !15, file: !16, type: !10)
95!27 = !DILocation(line: 11, column: 20, scope: !15)
96!28 = !DILocation(line: 12, column: 3, scope: !15)
97!29 = !DILocation(line: 13, column: 1, scope: !15)
98!30 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !20, type: !19)
99!31 = !DILocation(line: 0, scope: !20)
100!32 = !DILocalVariable(name: "sa", line: 7, arg: 2, scope: !20, file: !16, type: !10)
101!33 = !DILocation(line: 7, column: 17, scope: !20)
102!34 = !DILocation(line: 8, column: 3, scope: !20)
103