1 ; RUN: llc -march=hexagon -O2 < %s
3 ; Check for successful compilation.
5 target triple = "hexagon-unknown--elf"
11 @g0 = global { i32, i32 } { i32 ptrtoint (ptr @f0 to i32), i32 0 }, align 4
12 @g1 = global i32 0, align 4
13 @g2 = global %s.0 zeroinitializer, align 4
14 @g3 = global { i32, i32 } { i32 1, i32 0 }, align 4
15 @g4 = global i32 0, align 4
16 @g5 = global i32 0, align 4
17 @g6 = global i32 0, align 4
18 @g7 = private unnamed_addr constant [53 x i8] c"REF: ISO/IEC 14882:1998, 8.2.3 Pointers to members.\0A\00", align 1
19 @g8 = private unnamed_addr constant [6 x i8] c"%s\0A%s\00", align 1
20 @g9 = private unnamed_addr constant [43 x i8] c"Can we assign a pointer to member function\00", align 1
21 @g10 = private unnamed_addr constant [49 x i8] c" to a function member of the second base class?\0A\00", align 1
22 @g11 = external global i32
23 @g12 = private unnamed_addr constant [46 x i8] c"Can we assign a pointer to member to a member\00", align 1
24 @g13 = private unnamed_addr constant [29 x i8] c" of the second base class?\0A\00", align 1
25 @g14 = private unnamed_addr constant [7 x i8] c"%s\0A%s\0A\00", align 1
26 @g15 = private unnamed_addr constant [51 x i8] c"Testing dereferencing a pointer to member function\00", align 1
27 @g16 = private unnamed_addr constant [24 x i8] c"in a complex expression\00", align 1
28 @g17 = linkonce_odr unnamed_addr constant [3 x ptr] [ptr null, ptr @g20, ptr @f9]
29 @g18 = external global ptr
30 @g19 = linkonce_odr constant [3 x i8] c"1S\00"
31 @g20 = linkonce_odr constant { ptr, ptr } { ptr getelementptr inbounds (ptr, ptr @g18, i32 2), ptr @g19 }
33 ; Function Attrs: nounwind readnone
34 define linkonce_odr i32 @f0(ptr nocapture readnone %a0) #0 align 2 {
39 ; Function Attrs: nounwind readnone
45 define internal fastcc void @f2() {
47 %v0 = load i32, ptr @g5, align 4, !tbaa !0
48 %v1 = add nsw i32 %v0, 5
49 store i32 %v1, ptr @g5, align 4, !tbaa !0
50 %v2 = load { i32, i32 }, ptr @g3, align 4, !tbaa !4
51 %v3 = extractvalue { i32, i32 } %v2, 1
52 %v4 = getelementptr inbounds i8, ptr @g2, i32 %v3
53 %v6 = extractvalue { i32, i32 } %v2, 0
55 %v8 = icmp eq i32 %v7, 0
56 br i1 %v8, label %b2, label %b1
59 %v10 = load ptr, ptr %v4, align 4, !tbaa !5
60 %v11 = add i32 %v6, -1
61 %v12 = getelementptr i8, ptr %v10, i32 %v11
62 %v14 = load ptr, ptr %v12, align 4
66 %v15 = inttoptr i32 %v6 to ptr
69 b3: ; preds = %b2, %b1
70 %v16 = phi ptr [ %v14, %b1 ], [ %v15, %b2 ]
71 %v17 = tail call i32 %v16(ptr %v4)
72 store i32 %v17, ptr @g6, align 4, !tbaa !0
76 ; Function Attrs: nounwind readnone
79 %v0 = alloca %s.2, align 4
80 %v1 = alloca %s.2, align 4
83 tail call void (ptr, ...) @f6(ptr @g7)
84 tail call void (ptr, ...) @f6(ptr @g8, ptr @g9, ptr @g10)
85 %v2 = load { i32, i32 }, ptr @g0, align 4, !tbaa !4
86 %v3 = extractvalue { i32, i32 } %v2, 1
87 %v5 = getelementptr inbounds i8, ptr %v0, i32 %v3
88 %v7 = extractvalue { i32, i32 } %v2, 0
90 %v9 = icmp eq i32 %v8, 0
91 br i1 %v9, label %b1, label %b2
94 %v10 = inttoptr i32 %v7 to ptr
97 b2: ; preds = %b1, %b0
98 %v11 = phi ptr [ %v10, %b1 ], [ undef, %b0 ]
99 %v12 = call i32 %v11(ptr %v5)
100 %v13 = icmp eq i32 %v12, 11
101 br i1 %v13, label %b4, label %b3
104 store i32 1, ptr @g11, align 4, !tbaa !0
107 b4: ; preds = %b3, %b2
108 %v14 = call i32 @f7()
110 call void (ptr, ...) @f6(ptr @g8, ptr @g12, ptr @g13)
111 store i32 11, ptr %v1, align 4, !tbaa !7
112 %v16 = load i32, ptr @g1, align 4, !tbaa !4
113 %v18 = getelementptr inbounds i8, ptr %v1, i32 %v16
114 %v20 = load i32, ptr %v18, align 4, !tbaa !0
115 %v21 = icmp eq i32 %v20, 11
116 br i1 %v21, label %b6, label %b5
119 store i32 1, ptr @g11, align 4, !tbaa !0
122 b6: ; preds = %b5, %b4
123 %v22 = call i32 @f7()
125 call void (ptr, ...) @f6(ptr @g14, ptr @g15, ptr @g16)
126 %v23 = load i32, ptr @g4, align 4, !tbaa !0
127 %v24 = icmp eq i32 %v23, 11
128 br i1 %v24, label %b8, label %b7
131 store i32 1, ptr @g11, align 4, !tbaa !0
134 b8: ; preds = %b7, %b6
135 %v25 = call i32 @f7()
137 call void (ptr, ...) @f6(ptr @g14, ptr @g15, ptr @g16)
138 %v26 = load i32, ptr @g6, align 4, !tbaa !0
139 %v27 = icmp eq i32 %v26, 11
140 br i1 %v27, label %b10, label %b9
143 store i32 1, ptr @g11, align 4, !tbaa !0
146 b10: ; preds = %b9, %b8
147 %v28 = call i32 @f7()
148 %v29 = call i32 @f8(i32 4)
152 ; Function Attrs: nounwind readnone
153 declare void @f4() #0
155 ; Function Attrs: nounwind readnone
156 declare void @f5() #0
158 ; Function Attrs: nounwind readnone
159 declare void @f6(ptr, ...) #0
161 ; Function Attrs: nounwind readnone
164 ; Function Attrs: nounwind readnone
165 declare i32 @f8(i32) #0
167 ; Function Attrs: nounwind readnone
168 define linkonce_odr i32 @f9(ptr nocapture readnone %a0) unnamed_addr #0 align 2 {
173 define internal void @f10() {
175 store ptr getelementptr inbounds ([3 x ptr], ptr @g17, i32 0, i32 2), ptr @g2, align 4, !tbaa !5
176 %v0 = load { i32, i32 }, ptr @g3, align 4, !tbaa !4
177 %v1 = extractvalue { i32, i32 } %v0, 1
178 %v2 = getelementptr inbounds i8, ptr @g2, i32 %v1
179 %v4 = extractvalue { i32, i32 } %v0, 0
181 %v6 = icmp eq i32 %v5, 0
182 br i1 %v6, label %b2, label %b1
185 %v8 = load ptr, ptr %v2, align 4, !tbaa !5
186 %v9 = add i32 %v4, -1
187 %v10 = getelementptr i8, ptr %v8, i32 %v9
188 %v12 = load ptr, ptr %v10, align 4
192 %v13 = inttoptr i32 %v4 to ptr
195 b3: ; preds = %b2, %b1
196 %v14 = phi ptr [ %v12, %b1 ], [ %v13, %b2 ]
197 %v15 = tail call i32 %v14(ptr %v2)
198 store i32 %v15, ptr @g4, align 4, !tbaa !0
199 tail call fastcc void @f2()
203 attributes #0 = { nounwind readnone }
205 !0 = !{!1, !1, i64 0}
206 !1 = !{!"int", !2, i64 0}
207 !2 = !{!"omnipotent char", !3, i64 0}
208 !3 = !{!"Simple C/C++ TBAA"}
209 !4 = !{!2, !2, i64 0}
210 !5 = !{!6, !6, i64 0}
211 !6 = !{!"vtable pointer", !3, i64 0}
212 !7 = !{!8, !1, i64 0}
213 !8 = !{!"_ZTS2B2", !1, i64 0}