• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -march=hexagon -O2 < %s
2; REQUIRES: asserts
3; Check for successful compilation.
4
5target triple = "hexagon-unknown--elf"
6
7%s.0 = type { i32 (...)** }
8%s.1 = type { i32 }
9%s.2 = type { %s.1 }
10
11@g0 = global { i32, i32 } { i32 ptrtoint (i32 (%s.1*)* @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 i8*] [i8* null, i8* bitcast ({ i8*, i8* }* @g20 to i8*), i8* bitcast (i32 (%s.0*)* @f9 to i8*)]
29@g18 = external global i8*
30@g19 = linkonce_odr constant [3 x i8] c"1S\00"
31@g20 = linkonce_odr constant { i8*, i8* } { i8* bitcast (i8** getelementptr inbounds (i8*, i8** @g18, i32 2) to i8*), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @g19, i32 0, i32 0) }
32
33; Function Attrs: nounwind readnone
34define linkonce_odr i32 @f0(%s.1* nocapture readnone %a0) #0 align 2 {
35b0:
36  ret i32 11
37}
38
39; Function Attrs: nounwind readnone
40define %s.0* @f1() #0 {
41b0:
42  ret %s.0* @g2
43}
44
45define internal fastcc void @f2() {
46b0:
47  %v0 = load i32, i32* @g5, align 4, !tbaa !0
48  %v1 = add nsw i32 %v0, 5
49  store i32 %v1, i32* @g5, align 4, !tbaa !0
50  %v2 = load { i32, i32 }, { i32, i32 }* @g3, align 4, !tbaa !4
51  %v3 = extractvalue { i32, i32 } %v2, 1
52  %v4 = getelementptr inbounds i8, i8* bitcast (%s.0* @g2 to i8*), i32 %v3
53  %v5 = bitcast i8* %v4 to %s.0*
54  %v6 = extractvalue { i32, i32 } %v2, 0
55  %v7 = and i32 %v6, 1
56  %v8 = icmp eq i32 %v7, 0
57  br i1 %v8, label %b2, label %b1
58
59b1:                                               ; preds = %b0
60  %v9 = bitcast i8* %v4 to i8**
61  %v10 = load i8*, i8** %v9, align 4, !tbaa !5
62  %v11 = add i32 %v6, -1
63  %v12 = getelementptr i8, i8* %v10, i32 %v11
64  %v13 = bitcast i8* %v12 to i32 (%s.0*)**
65  %v14 = load i32 (%s.0*)*, i32 (%s.0*)** %v13, align 4
66  br label %b3
67
68b2:                                               ; preds = %b0
69  %v15 = inttoptr i32 %v6 to i32 (%s.0*)*
70  br label %b3
71
72b3:                                               ; preds = %b2, %b1
73  %v16 = phi i32 (%s.0*)* [ %v14, %b1 ], [ %v15, %b2 ]
74  %v17 = tail call i32 %v16(%s.0* %v5)
75  store i32 %v17, i32* @g6, align 4, !tbaa !0
76  ret void
77}
78
79; Function Attrs: nounwind readnone
80define i32 @f3() #0 {
81b0:
82  %v0 = alloca %s.2, align 4
83  %v1 = alloca %s.2, align 4
84  tail call void @f4()
85  tail call void @f5()
86  tail call void (i8*, ...) @f6(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @g7, i32 0, i32 0))
87  tail call void (i8*, ...) @f6(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @g8, i32 0, i32 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @g9, i32 0, i32 0), i8* getelementptr inbounds ([49 x i8], [49 x i8]* @g10, i32 0, i32 0))
88  %v2 = load { i32, i32 }, { i32, i32 }* @g0, align 4, !tbaa !4
89  %v3 = extractvalue { i32, i32 } %v2, 1
90  %v4 = bitcast %s.2* %v0 to i8*
91  %v5 = getelementptr inbounds i8, i8* %v4, i32 %v3
92  %v6 = bitcast i8* %v5 to %s.2*
93  %v7 = extractvalue { i32, i32 } %v2, 0
94  %v8 = and i32 %v7, 1
95  %v9 = icmp eq i32 %v8, 0
96  br i1 %v9, label %b1, label %b2
97
98b1:                                               ; preds = %b0
99  %v10 = inttoptr i32 %v7 to i32 (%s.2*)*
100  br label %b2
101
102b2:                                               ; preds = %b1, %b0
103  %v11 = phi i32 (%s.2*)* [ %v10, %b1 ], [ undef, %b0 ]
104  %v12 = call i32 %v11(%s.2* %v6)
105  %v13 = icmp eq i32 %v12, 11
106  br i1 %v13, label %b4, label %b3
107
108b3:                                               ; preds = %b2
109  store i32 1, i32* @g11, align 4, !tbaa !0
110  br label %b4
111
112b4:                                               ; preds = %b3, %b2
113  %v14 = call i32 @f7()
114  call void @f5()
115  call void (i8*, ...) @f6(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @g8, i32 0, i32 0), i8* getelementptr inbounds ([46 x i8], [46 x i8]* @g12, i32 0, i32 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @g13, i32 0, i32 0))
116  %v15 = getelementptr inbounds %s.2, %s.2* %v1, i32 0, i32 0, i32 0
117  store i32 11, i32* %v15, align 4, !tbaa !7
118  %v16 = load i32, i32* @g1, align 4, !tbaa !4
119  %v17 = bitcast %s.2* %v1 to i8*
120  %v18 = getelementptr inbounds i8, i8* %v17, i32 %v16
121  %v19 = bitcast i8* %v18 to i32*
122  %v20 = load i32, i32* %v19, align 4, !tbaa !0
123  %v21 = icmp eq i32 %v20, 11
124  br i1 %v21, label %b6, label %b5
125
126b5:                                               ; preds = %b4
127  store i32 1, i32* @g11, align 4, !tbaa !0
128  br label %b6
129
130b6:                                               ; preds = %b5, %b4
131  %v22 = call i32 @f7()
132  call void @f5()
133  call void (i8*, ...) @f6(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @g14, i32 0, i32 0), i8* getelementptr inbounds ([51 x i8], [51 x i8]* @g15, i32 0, i32 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @g16, i32 0, i32 0))
134  %v23 = load i32, i32* @g4, align 4, !tbaa !0
135  %v24 = icmp eq i32 %v23, 11
136  br i1 %v24, label %b8, label %b7
137
138b7:                                               ; preds = %b6
139  store i32 1, i32* @g11, align 4, !tbaa !0
140  br label %b8
141
142b8:                                               ; preds = %b7, %b6
143  %v25 = call i32 @f7()
144  call void @f5()
145  call void (i8*, ...) @f6(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @g14, i32 0, i32 0), i8* getelementptr inbounds ([51 x i8], [51 x i8]* @g15, i32 0, i32 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @g16, i32 0, i32 0))
146  %v26 = load i32, i32* @g6, align 4, !tbaa !0
147  %v27 = icmp eq i32 %v26, 11
148  br i1 %v27, label %b10, label %b9
149
150b9:                                               ; preds = %b8
151  store i32 1, i32* @g11, align 4, !tbaa !0
152  br label %b10
153
154b10:                                              ; preds = %b9, %b8
155  %v28 = call i32 @f7()
156  %v29 = call i32 @f8(i32 4)
157  ret i32 %v29
158}
159
160; Function Attrs: nounwind readnone
161declare void @f4() #0
162
163; Function Attrs: nounwind readnone
164declare void @f5() #0
165
166; Function Attrs: nounwind readnone
167declare void @f6(i8*, ...) #0
168
169; Function Attrs: nounwind readnone
170declare i32 @f7() #0
171
172; Function Attrs: nounwind readnone
173declare i32 @f8(i32) #0
174
175; Function Attrs: nounwind readnone
176define linkonce_odr i32 @f9(%s.0* nocapture readnone %a0) unnamed_addr #0 align 2 {
177b0:
178  ret i32 11
179}
180
181define internal void @f10() {
182b0:
183  store i32 (...)** bitcast (i8** getelementptr inbounds ([3 x i8*], [3 x i8*]* @g17, i32 0, i32 2) to i32 (...)**), i32 (...)*** getelementptr inbounds (%s.0, %s.0* @g2, i32 0, i32 0), align 4, !tbaa !5
184  %v0 = load { i32, i32 }, { i32, i32 }* @g3, align 4, !tbaa !4
185  %v1 = extractvalue { i32, i32 } %v0, 1
186  %v2 = getelementptr inbounds i8, i8* bitcast (%s.0* @g2 to i8*), i32 %v1
187  %v3 = bitcast i8* %v2 to %s.0*
188  %v4 = extractvalue { i32, i32 } %v0, 0
189  %v5 = and i32 %v4, 1
190  %v6 = icmp eq i32 %v5, 0
191  br i1 %v6, label %b2, label %b1
192
193b1:                                               ; preds = %b0
194  %v7 = bitcast i8* %v2 to i8**
195  %v8 = load i8*, i8** %v7, align 4, !tbaa !5
196  %v9 = add i32 %v4, -1
197  %v10 = getelementptr i8, i8* %v8, i32 %v9
198  %v11 = bitcast i8* %v10 to i32 (%s.0*)**
199  %v12 = load i32 (%s.0*)*, i32 (%s.0*)** %v11, align 4
200  br label %b3
201
202b2:                                               ; preds = %b0
203  %v13 = inttoptr i32 %v4 to i32 (%s.0*)*
204  br label %b3
205
206b3:                                               ; preds = %b2, %b1
207  %v14 = phi i32 (%s.0*)* [ %v12, %b1 ], [ %v13, %b2 ]
208  %v15 = tail call i32 %v14(%s.0* %v3)
209  store i32 %v15, i32* @g4, align 4, !tbaa !0
210  tail call fastcc void @f2()
211  ret void
212}
213
214attributes #0 = { nounwind readnone }
215
216!0 = !{!1, !1, i64 0}
217!1 = !{!"int", !2, i64 0}
218!2 = !{!"omnipotent char", !3, i64 0}
219!3 = !{!"Simple C/C++ TBAA"}
220!4 = !{!2, !2, i64 0}
221!5 = !{!6, !6, i64 0}
222!6 = !{!"vtable pointer", !3, i64 0}
223!7 = !{!8, !1, i64 0}
224!8 = !{!"_ZTS2B2", !1, i64 0}
225