Assigning and copying command line option objects shouldn't be allowed.
[oota-llvm.git] / test / Linker / type-unique-type-array-a.ll
1 ; REQUIRES: object-emission
2 ;
3 ; RUN: llvm-link %s %p/type-unique-type-array-b.ll -S -o - | %llc_dwarf -filetype=obj -O0 | llvm-dwarfdump -debug-dump=info - | FileCheck %s
4 ;
5 ; rdar://problem/17628609
6 ;
7 ; cat -n a.cpp
8 ;     1 struct SA {
9 ;     2   int a;
10 ;     3 };
11 ;     4 
12 ;     5 class A {
13 ;     6 public:
14 ;     7   void testA(SA a) {
15 ;     8   }
16 ;     9 };
17 ;    10 
18 ;    11 void topA(A *a, SA sa) {
19 ;    12   a->testA(sa);
20 ;    13 }
21 ;
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_MIPS_linkage_name {{.*}} "_ZN1A5testAE2SA"
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"
32
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_MIPS_linkage_name {{.*}} "_ZN1B5testBE2SA"
38 ; CHECK: DW_TAG_formal_parameter
39 ; CHECK: DW_TAG_formal_parameter
40 ; CHECK-NEXT: DW_AT_type [DW_FORM_ref_addr] {{.*}}[[STRUCT]]
41
42 %class.A = type { i8 }
43 %struct.SA = type { i32 }
44
45 ; Function Attrs: ssp uwtable
46 define void @_Z4topAP1A2SA(%class.A* %a, i32 %sa.coerce) #0 {
47 entry:
48   %sa = alloca %struct.SA, align 4
49   %a.addr = alloca %class.A*, align 8
50   %agg.tmp = alloca %struct.SA, align 4
51   %coerce.dive = getelementptr %struct.SA* %sa, i32 0, i32 0
52   store i32 %sa.coerce, i32* %coerce.dive
53   store %class.A* %a, %class.A** %a.addr, align 8
54   call void @llvm.dbg.declare(metadata %class.A** %a.addr, metadata !24, metadata !{!"0x102"}), !dbg !25
55   call void @llvm.dbg.declare(metadata %struct.SA* %sa, metadata !26, metadata !{!"0x102"}), !dbg !27
56   %0 = load %class.A** %a.addr, align 8, !dbg !28
57   %1 = bitcast %struct.SA* %agg.tmp to i8*, !dbg !28
58   %2 = bitcast %struct.SA* %sa to i8*, !dbg !28
59   call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* %2, i64 4, i32 4, i1 false), !dbg !28
60   %coerce.dive1 = getelementptr %struct.SA* %agg.tmp, i32 0, i32 0, !dbg !28
61   %3 = load i32* %coerce.dive1, !dbg !28
62   call void @_ZN1A5testAE2SA(%class.A* %0, i32 %3), !dbg !28
63   ret void, !dbg !29
64 }
65
66 ; Function Attrs: nounwind readnone
67 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
68
69 ; Function Attrs: nounwind ssp uwtable
70 define linkonce_odr void @_ZN1A5testAE2SA(%class.A* %this, i32 %a.coerce) #2 align 2 {
71 entry:
72   %a = alloca %struct.SA, align 4
73   %this.addr = alloca %class.A*, align 8
74   %coerce.dive = getelementptr %struct.SA* %a, i32 0, i32 0
75   store i32 %a.coerce, i32* %coerce.dive
76   store %class.A* %this, %class.A** %this.addr, align 8
77   call void @llvm.dbg.declare(metadata %class.A** %this.addr, metadata !30, metadata !{!"0x102"}), !dbg !31
78   call void @llvm.dbg.declare(metadata %struct.SA* %a, metadata !32, metadata !{!"0x102"}), !dbg !33
79   %this1 = load %class.A** %this.addr
80   ret void, !dbg !34
81 }
82
83 ; Function Attrs: nounwind
84 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i32, i1) #3
85
86 attributes #0 = { ssp uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
87 attributes #1 = { nounwind readnone }
88 attributes #2 = { nounwind ssp uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
89 attributes #3 = { nounwind }
90
91 !llvm.dbg.cu = !{!0}
92 !llvm.module.flags = !{!21, !22}
93 !llvm.ident = !{!23}
94
95 !0 = !{!"0x11\004\00clang version 3.5.0 (trunk 214102:214113M) (llvm/trunk 214102:214115M)\000\00\000\00\001", !1, !2, !3, !14, !2, !2} ; [ DW_TAG_compile_unit ] [a.cpp] [DW_LANG_C_plus_plus]
96 !1 = !{!"a.cpp", !"/Users/manmanren/test-Nov/type_unique/rdar_di_array"}
97 !2 = !{}
98 !3 = !{!4, !10}
99 !4 = !{!"0x2\00A\005\008\008\000\000\000", !1, null, null, !5, null, null, !"_ZTS1A"} ; [ DW_TAG_class_type ] [A] [line 5, size 8, align 8, offset 0] [def] [from ]
100 !5 = !{!6}
101 !6 = !{!"0x2e\00testA\00testA\00_ZN1A5testAE2SA\007\000\000\000\006\00256\000\007", !1, !"_ZTS1A", !7, null, null, null, i32 0, null} ; [ DW_TAG_subprogram ] [line 7] [testA]
102 !7 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !8, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
103 !8 = !{null, !9, !"_ZTS2SA"}
104 !9 = !{!"0xf\00\000\0064\0064\000\001088", null, null, !"_ZTS1A"} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [artificial] [from _ZTS1A]
105 !10 = !{!"0x13\00SA\001\0032\0032\000\000\000", !1, null, null, !11, null, null, !"_ZTS2SA"} ; [ DW_TAG_structure_type ] [SA] [line 1, size 32, align 32, offset 0] [def] [from ]
106 !11 = !{!12}
107 !12 = !{!"0xd\00a\002\0032\0032\000\000", !1, !"_ZTS2SA", !13} ; [ DW_TAG_member ] [a] [line 2, size 32, align 32, offset 0] [from int]
108 !13 = !{!"0x24\00int\000\0032\0032\000\000\005", null, null} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
109 !14 = !{!15, !20}
110 !15 = !{!"0x2e\00topA\00topA\00_Z4topAP1A2SA\0011\000\001\000\006\00256\000\0011", !1, !16, !17, null, void (%class.A*, i32)* @_Z4topAP1A2SA, null, null, !2} ; [ DW_TAG_subprogram ] [line 11] [def] [topA]
111 !16 = !{!"0x29", !1}         ; [ DW_TAG_file_type ] [a.cpp]
112 !17 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !18, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
113 !18 = !{null, !19, !"_ZTS2SA"}
114 !19 = !{!"0xf\00\000\0064\0064\000\000", null, null, !"_ZTS1A"} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from _ZTS1A]
115 !20 = !{!"0x2e\00testA\00testA\00_ZN1A5testAE2SA\007\000\001\000\006\00256\000\007", !1, !"_ZTS1A", !7, null, void (%class.A*, i32)* @_ZN1A5testAE2SA, null, !6, !2} ; [ DW_TAG_subprogram ] [line 7] [def] [testA]
116 !21 = !{i32 2, !"Dwarf Version", i32 2}
117 !22 = !{i32 2, !"Debug Info Version", i32 2}
118 !23 = !{!"clang version 3.5.0 (trunk 214102:214113M) (llvm/trunk 214102:214115M)"}
119 !24 = !{!"0x101\00a\0016777227\000", !15, !16, !19} ; [ DW_TAG_arg_variable ] [a] [line 11]
120 !25 = !MDLocation(line: 11, column: 14, scope: !15)
121 !26 = !{!"0x101\00sa\0033554443\000", !15, !16, !"_ZTS2SA"} ; [ DW_TAG_arg_variable ] [sa] [line 11]
122 !27 = !MDLocation(line: 11, column: 20, scope: !15)
123 !28 = !MDLocation(line: 12, column: 3, scope: !15)
124 !29 = !MDLocation(line: 13, column: 1, scope: !15)
125 !30 = !{!"0x101\00this\0016777216\001088", !20, null, !19} ; [ DW_TAG_arg_variable ] [this] [line 0]
126 !31 = !MDLocation(line: 0, scope: !20)
127 !32 = !{!"0x101\00a\0033554439\000", !20, !16, !"_ZTS2SA"} ; [ DW_TAG_arg_variable ] [a] [line 7]
128 !33 = !MDLocation(line: 7, column: 17, scope: !20)
129 !34 = !MDLocation(line: 8, column: 3, scope: !20)