1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -constraint-elimination -S %s | FileCheck %s
4 %struct.1 = type { i32, i64, i8 }
6 define i1 @test.ult.true.due.to.first.dimension(%struct.1* %start, i8* %high) {
7 ; CHECK-LABEL: @test.ult.true.due.to.first.dimension(
9 ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds [[STRUCT_1:%.*]], %struct.1* [[START:%.*]], i64 6, i32 0
10 ; CHECK-NEXT: [[ADD_PTR_CAST:%.*]] = bitcast i32* [[ADD_PTR]] to i8*
11 ; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8* [[ADD_PTR_CAST]], [[HIGH:%.*]]
12 ; CHECK-NEXT: br i1 [[C_1]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
14 ; CHECK-NEXT: [[START_0:%.*]] = getelementptr inbounds [[STRUCT_1]], %struct.1* [[START]], i64 5, i32 0
15 ; CHECK-NEXT: [[START_0_CAST:%.*]] = bitcast i32* [[START_0]] to i8*
16 ; CHECK-NEXT: [[C_0:%.*]] = icmp ult i8* [[START_0_CAST]], [[HIGH]]
17 ; CHECK-NEXT: ret i1 [[C_0]]
19 ; CHECK-NEXT: ret i1 true
22 %add.ptr = getelementptr inbounds %struct.1, %struct.1* %start, i64 6, i32 0
23 %add.ptr.cast = bitcast i32* %add.ptr to i8*
24 %c.1 = icmp ule i8* %add.ptr.cast, %high
25 br i1 %c.1, label %if.then, label %if.end
27 if.then: ; preds = %entry
28 %start.0 = getelementptr inbounds %struct.1, %struct.1* %start, i64 5, i32 0
29 %start.0.cast = bitcast i32* %start.0 to i8*
30 %c.0 = icmp ult i8* %start.0.cast, %high
33 if.end: ; preds = %entry
37 define i1 @test.ult.true.due.to.first.dimension.var.index.0(%struct.1* %start, i8* %high, i32 %idx) {
38 ; CHECK-LABEL: @test.ult.true.due.to.first.dimension.var.index.0(
40 ; CHECK-NEXT: [[IDX_EXT_PLUS_1:%.*]] = add nuw nsw i32 [[IDX:%.*]], 1
41 ; CHECK-NEXT: [[IDX_EXT_PLUS_1_EXT:%.*]] = zext i32 [[IDX_EXT_PLUS_1]] to i64
42 ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds [[STRUCT_1:%.*]], %struct.1* [[START:%.*]], i64 [[IDX_EXT_PLUS_1_EXT]], i32 0
43 ; CHECK-NEXT: [[ADD_PTR_CAST:%.*]] = bitcast i32* [[ADD_PTR]] to i8*
44 ; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8* [[ADD_PTR_CAST]], [[HIGH:%.*]]
45 ; CHECK-NEXT: br i1 [[C_1]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
47 ; CHECK-NEXT: [[IDX_EXT:%.*]] = zext i32 [[IDX]] to i64
48 ; CHECK-NEXT: [[START_0:%.*]] = getelementptr inbounds [[STRUCT_1]], %struct.1* [[START]], i64 [[IDX_EXT]], i32 0
49 ; CHECK-NEXT: [[START_0_CAST:%.*]] = bitcast i32* [[START_0]] to i8*
50 ; CHECK-NEXT: [[C_0:%.*]] = icmp ult i8* [[START_0_CAST]], [[HIGH]]
51 ; CHECK-NEXT: ret i1 [[C_0]]
53 ; CHECK-NEXT: ret i1 true
56 %idx.ext.plus.1 = add nuw nsw i32 %idx, 1
57 %idx.ext.plus.1.ext = zext i32 %idx.ext.plus.1 to i64
58 %add.ptr = getelementptr inbounds %struct.1, %struct.1* %start, i64 %idx.ext.plus.1.ext, i32 0
59 %add.ptr.cast = bitcast i32* %add.ptr to i8*
60 %c.1 = icmp ule i8* %add.ptr.cast, %high
61 br i1 %c.1, label %if.then, label %if.end
63 if.then: ; preds = %entry
64 %idx.ext = zext i32 %idx to i64
65 %start.0 = getelementptr inbounds %struct.1, %struct.1* %start, i64 %idx.ext, i32 0
66 %start.0.cast = bitcast i32* %start.0 to i8*
67 %c.0 = icmp ult i8* %start.0.cast, %high
70 if.end: ; preds = %entry
74 define i1 @test.ult.true.due.to.first.dimension.var.index.1(%struct.1* %start, i8* %high, i32 %idx) {
75 ; CHECK-LABEL: @test.ult.true.due.to.first.dimension.var.index.1(
77 ; CHECK-NEXT: [[IDX_EXT_PLUS_1:%.*]] = add nuw nsw i32 [[IDX:%.*]], 1
78 ; CHECK-NEXT: [[IDX_EXT_PLUS_1_EXT:%.*]] = zext i32 [[IDX_EXT_PLUS_1]] to i64
79 ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds [[STRUCT_1:%.*]], %struct.1* [[START:%.*]], i64 [[IDX_EXT_PLUS_1_EXT]], i32 0
80 ; CHECK-NEXT: [[ADD_PTR_CAST:%.*]] = bitcast i32* [[ADD_PTR]] to i8*
81 ; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8* [[ADD_PTR_CAST]], [[HIGH:%.*]]
82 ; CHECK-NEXT: br i1 [[C_1]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
84 ; CHECK-NEXT: [[IDX_EXT:%.*]] = zext i32 [[IDX]] to i64
85 ; CHECK-NEXT: [[START_0:%.*]] = getelementptr inbounds [[STRUCT_1]], %struct.1* [[START]], i64 [[IDX_EXT]], i32 1
86 ; CHECK-NEXT: [[START_0_CAST:%.*]] = bitcast i64* [[START_0]] to i8*
87 ; CHECK-NEXT: [[C_0:%.*]] = icmp ult i8* [[START_0_CAST]], [[HIGH]]
88 ; CHECK-NEXT: ret i1 [[C_0]]
90 ; CHECK-NEXT: ret i1 true
93 %idx.ext.plus.1 = add nuw nsw i32 %idx, 1
94 %idx.ext.plus.1.ext = zext i32 %idx.ext.plus.1 to i64
95 %add.ptr = getelementptr inbounds %struct.1, %struct.1* %start, i64 %idx.ext.plus.1.ext, i32 0
96 %add.ptr.cast = bitcast i32* %add.ptr to i8*
97 %c.1 = icmp ule i8* %add.ptr.cast, %high
98 br i1 %c.1, label %if.then, label %if.end
100 if.then: ; preds = %entry
101 %idx.ext = zext i32 %idx to i64
102 %start.0 = getelementptr inbounds %struct.1, %struct.1* %start, i64 %idx.ext, i32 1
103 %start.0.cast = bitcast i64* %start.0 to i8*
104 %c.0 = icmp ult i8* %start.0.cast, %high
107 if.end: ; preds = %entry
111 define i1 @test.ult.true.due.to.first.dimension.var.index.2(%struct.1* %start, i8* %high, i32 %idx) {
112 ; CHECK-LABEL: @test.ult.true.due.to.first.dimension.var.index.2(
114 ; CHECK-NEXT: [[IDX_EXT_PLUS_1:%.*]] = add nuw nsw i32 [[IDX:%.*]], 1
115 ; CHECK-NEXT: [[IDX_EXT_PLUS_1_EXT:%.*]] = zext i32 [[IDX_EXT_PLUS_1]] to i64
116 ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds [[STRUCT_1:%.*]], %struct.1* [[START:%.*]], i64 [[IDX_EXT_PLUS_1_EXT]], i32 0
117 ; CHECK-NEXT: [[ADD_PTR_CAST:%.*]] = bitcast i32* [[ADD_PTR]] to i8*
118 ; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8* [[ADD_PTR_CAST]], [[HIGH:%.*]]
119 ; CHECK-NEXT: br i1 [[C_1]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
121 ; CHECK-NEXT: [[IDX_EXT:%.*]] = zext i32 [[IDX]] to i64
122 ; CHECK-NEXT: [[START_0:%.*]] = getelementptr inbounds [[STRUCT_1]], %struct.1* [[START]], i64 [[IDX_EXT]], i32 2
123 ; CHECK-NEXT: [[C_0:%.*]] = icmp ult i8* [[START_0]], [[HIGH]]
124 ; CHECK-NEXT: ret i1 [[C_0]]
126 ; CHECK-NEXT: ret i1 true
129 %idx.ext.plus.1 = add nuw nsw i32 %idx, 1
130 %idx.ext.plus.1.ext = zext i32 %idx.ext.plus.1 to i64
131 %add.ptr = getelementptr inbounds %struct.1, %struct.1* %start, i64 %idx.ext.plus.1.ext, i32 0
132 %add.ptr.cast = bitcast i32* %add.ptr to i8*
133 %c.1 = icmp ule i8* %add.ptr.cast, %high
134 br i1 %c.1, label %if.then, label %if.end
136 if.then: ; preds = %entry
137 %idx.ext = zext i32 %idx to i64
138 %start.0 = getelementptr inbounds %struct.1, %struct.1* %start, i64 %idx.ext, i32 2
139 %c.0 = icmp ult i8* %start.0, %high
142 if.end: ; preds = %entry
146 define i1 @test.ult.unknown.due.to.first.dimension(%struct.1* %start, i8* %high) {
147 ; CHECK-LABEL: @test.ult.unknown.due.to.first.dimension(
149 ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds [[STRUCT_1:%.*]], %struct.1* [[START:%.*]], i64 5, i32 0
150 ; CHECK-NEXT: [[ADD_PTR_CAST:%.*]] = bitcast i32* [[ADD_PTR]] to i8*
151 ; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8* [[ADD_PTR_CAST]], [[HIGH:%.*]]
152 ; CHECK-NEXT: br i1 [[C_1]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
154 ; CHECK-NEXT: [[START_0:%.*]] = getelementptr inbounds [[STRUCT_1]], %struct.1* [[START]], i64 6, i32 0
155 ; CHECK-NEXT: [[START_0_CAST:%.*]] = bitcast i32* [[START_0]] to i8*
156 ; CHECK-NEXT: [[C_0:%.*]] = icmp ult i8* [[START_0_CAST]], [[HIGH]]
157 ; CHECK-NEXT: ret i1 [[C_0]]
159 ; CHECK-NEXT: ret i1 true
162 %add.ptr = getelementptr inbounds %struct.1, %struct.1* %start, i64 5, i32 0
163 %add.ptr.cast = bitcast i32* %add.ptr to i8*
164 %c.1 = icmp ule i8* %add.ptr.cast, %high
165 br i1 %c.1, label %if.then, label %if.end
167 if.then: ; preds = %entry
168 %start.0 = getelementptr inbounds %struct.1, %struct.1* %start, i64 6, i32 0
169 %start.0.cast = bitcast i32* %start.0 to i8*
170 %c.0 = icmp ult i8* %start.0.cast, %high
173 if.end: ; preds = %entry
177 define i1 @test.ult.true.due.to.second.dimension(%struct.1* %start, i8* %high) {
178 ; CHECK-LABEL: @test.ult.true.due.to.second.dimension(
180 ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds [[STRUCT_1:%.*]], %struct.1* [[START:%.*]], i64 5, i32 2
181 ; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8* [[ADD_PTR]], [[HIGH:%.*]]
182 ; CHECK-NEXT: br i1 [[C_1]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
184 ; CHECK-NEXT: [[START_0:%.*]] = getelementptr inbounds [[STRUCT_1]], %struct.1* [[START]], i64 5, i32 1
185 ; CHECK-NEXT: [[START_0_CAST:%.*]] = bitcast i64* [[START_0]] to i8*
186 ; CHECK-NEXT: [[C_0:%.*]] = icmp ult i8* [[START_0_CAST]], [[HIGH]]
187 ; CHECK-NEXT: ret i1 [[C_0]]
189 ; CHECK-NEXT: ret i1 true
192 %add.ptr = getelementptr inbounds %struct.1, %struct.1* %start, i64 5, i32 2
193 %c.1 = icmp ule i8* %add.ptr, %high
194 br i1 %c.1, label %if.then, label %if.end
196 if.then: ; preds = %entry
197 %start.0 = getelementptr inbounds %struct.1, %struct.1* %start, i64 5, i32 1
198 %start.0.cast = bitcast i64 * %start.0 to i8*
199 %c.0 = icmp ult i8* %start.0.cast, %high
202 if.end: ; preds = %entry
206 define i1 @test.ult.unknown.due.to.second.dimension(%struct.1* %start, i8* %high) {
207 ; CHECK-LABEL: @test.ult.unknown.due.to.second.dimension(
209 ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds [[STRUCT_1:%.*]], %struct.1* [[START:%.*]], i64 5, i32 2
210 ; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8* [[ADD_PTR]], [[HIGH:%.*]]
211 ; CHECK-NEXT: br i1 [[C_1]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
213 ; CHECK-NEXT: [[START_0:%.*]] = getelementptr inbounds [[STRUCT_1]], %struct.1* [[START]], i64 5, i32 2
214 ; CHECK-NEXT: [[C_0:%.*]] = icmp ult i8* [[START_0]], [[HIGH]]
215 ; CHECK-NEXT: ret i1 [[C_0]]
217 ; CHECK-NEXT: ret i1 true
220 %add.ptr = getelementptr inbounds %struct.1, %struct.1* %start, i64 5, i32 2
221 %c.1 = icmp ule i8* %add.ptr, %high
222 br i1 %c.1, label %if.then, label %if.end
224 if.then: ; preds = %entry
225 %start.0 = getelementptr inbounds %struct.1, %struct.1* %start, i64 5, i32 2
226 %c.0 = icmp ult i8* %start.0, %high
229 if.end: ; preds = %entry
233 define i1 @test.ult.unknown.due.to.second.dimension.var.index.0(%struct.1* %start, i8* %high, i32 %idx) {
234 ; CHECK-LABEL: @test.ult.unknown.due.to.second.dimension.var.index.0(
236 ; CHECK-NEXT: [[IDX_EXT:%.*]] = zext i32 [[IDX:%.*]] to i64
237 ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds [[STRUCT_1:%.*]], %struct.1* [[START:%.*]], i64 [[IDX_EXT]], i32 0
238 ; CHECK-NEXT: [[ADD_PTR_CAST:%.*]] = bitcast i32* [[ADD_PTR]] to i8*
239 ; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8* [[ADD_PTR_CAST]], [[HIGH:%.*]]
240 ; CHECK-NEXT: br i1 [[C_1]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
242 ; CHECK-NEXT: [[START_0:%.*]] = getelementptr inbounds [[STRUCT_1]], %struct.1* [[START]], i64 [[IDX_EXT]], i32 1
243 ; CHECK-NEXT: [[START_0_CAST:%.*]] = bitcast i64* [[START_0]] to i8*
244 ; CHECK-NEXT: [[C_0:%.*]] = icmp ult i8* [[START_0_CAST]], [[HIGH]]
245 ; CHECK-NEXT: ret i1 [[C_0]]
247 ; CHECK-NEXT: ret i1 true
250 %idx.ext = zext i32 %idx to i64
251 %add.ptr = getelementptr inbounds %struct.1, %struct.1* %start, i64 %idx.ext, i32 0
252 %add.ptr.cast = bitcast i32* %add.ptr to i8*
253 %c.1 = icmp ule i8* %add.ptr.cast, %high
254 br i1 %c.1, label %if.then, label %if.end
256 if.then: ; preds = %entry
257 %start.0 = getelementptr inbounds %struct.1, %struct.1* %start, i64 %idx.ext, i32 1
258 %start.0.cast = bitcast i64* %start.0 to i8*
259 %c.0 = icmp ult i8* %start.0.cast, %high
262 if.end: ; preds = %entry
266 define i1 @test.ult.unknown.due.to.second.dimension.var.index.1(%struct.1* %start, i8* %high, i32 %idx) {
267 ; CHECK-LABEL: @test.ult.unknown.due.to.second.dimension.var.index.1(
269 ; CHECK-NEXT: [[IDX_EXT:%.*]] = zext i32 [[IDX:%.*]] to i64
270 ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds [[STRUCT_1:%.*]], %struct.1* [[START:%.*]], i64 [[IDX_EXT]], i32 1
271 ; CHECK-NEXT: [[ADD_PTR_CAST:%.*]] = bitcast i64* [[ADD_PTR]] to i8*
272 ; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8* [[ADD_PTR_CAST]], [[HIGH:%.*]]
273 ; CHECK-NEXT: br i1 [[C_1]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
275 ; CHECK-NEXT: [[START_0:%.*]] = getelementptr inbounds [[STRUCT_1]], %struct.1* [[START]], i64 [[IDX_EXT]], i32 2
276 ; CHECK-NEXT: [[C_0:%.*]] = icmp ult i8* [[START_0]], [[HIGH]]
277 ; CHECK-NEXT: ret i1 [[C_0]]
279 ; CHECK-NEXT: ret i1 true
282 %idx.ext = zext i32 %idx to i64
283 %add.ptr = getelementptr inbounds %struct.1, %struct.1* %start, i64 %idx.ext, i32 1
284 %add.ptr.cast = bitcast i64* %add.ptr to i8*
285 %c.1 = icmp ule i8* %add.ptr.cast, %high
286 br i1 %c.1, label %if.then, label %if.end
288 if.then: ; preds = %entry
289 %start.0 = getelementptr inbounds %struct.1, %struct.1* %start, i64 %idx.ext, i32 2
290 %c.0 = icmp ult i8* %start.0, %high
293 if.end: ; preds = %entry
297 %struct.2 = type { i32, [20 x i64], i8 }
299 define i1 @ptr.int.struct.test.ult.true.due.to.first.dimension(%struct.2* %start, i8* %high) {
300 ; CHECK-LABEL: @ptr.int.struct.test.ult.true.due.to.first.dimension(
302 ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds [[STRUCT_2:%.*]], %struct.2* [[START:%.*]], i64 6, i32 1, i32 5
303 ; CHECK-NEXT: [[ADD_PTR_CAST:%.*]] = bitcast i64* [[ADD_PTR]] to i8*
304 ; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8* [[ADD_PTR_CAST]], [[HIGH:%.*]]
305 ; CHECK-NEXT: br i1 [[C_1]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
307 ; CHECK-NEXT: [[START_0:%.*]] = getelementptr inbounds [[STRUCT_2]], %struct.2* [[START]], i64 6, i32 0
308 ; CHECK-NEXT: [[START_0_CAST:%.*]] = bitcast i32* [[START_0]] to i8*
309 ; CHECK-NEXT: [[C_0:%.*]] = icmp ult i8* [[START_0_CAST]], [[HIGH]]
310 ; CHECK-NEXT: ret i1 [[C_0]]
312 ; CHECK-NEXT: ret i1 true
315 %add.ptr = getelementptr inbounds %struct.2, %struct.2* %start, i64 6, i32 1, i32 5
316 %add.ptr.cast = bitcast i64* %add.ptr to i8*
317 %c.1 = icmp ule i8* %add.ptr.cast, %high
318 br i1 %c.1, label %if.then, label %if.end
320 if.then: ; preds = %entry
321 %start.0 = getelementptr inbounds %struct.2, %struct.2* %start, i64 6, i32 0
322 %start.0.cast = bitcast i32* %start.0 to i8*
323 %c.0 = icmp ult i8* %start.0.cast, %high
326 if.end: ; preds = %entry
330 define i1 @ptr.int.struct.test.ult.true.due.to.third.dimension.var.index(%struct.2* %start, i8* %high, i32 %idx) {
331 ; CHECK-LABEL: @ptr.int.struct.test.ult.true.due.to.third.dimension.var.index(
333 ; CHECK-NEXT: [[IDX_EXT_PLUS_1:%.*]] = add nuw nsw i32 [[IDX:%.*]], 1
334 ; CHECK-NEXT: [[IDX_EXT_PLUS_1_EXT:%.*]] = zext i32 [[IDX_EXT_PLUS_1]] to i64
335 ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds [[STRUCT_2:%.*]], %struct.2* [[START:%.*]], i64 6, i32 1, i64 [[IDX_EXT_PLUS_1_EXT]]
336 ; CHECK-NEXT: [[ADD_PTR_CAST:%.*]] = bitcast i64* [[ADD_PTR]] to i8*
337 ; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8* [[ADD_PTR_CAST]], [[HIGH:%.*]]
338 ; CHECK-NEXT: br i1 [[C_1]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
340 ; CHECK-NEXT: [[IDX_EXT:%.*]] = zext i32 [[IDX]] to i64
341 ; CHECK-NEXT: [[START_0:%.*]] = getelementptr inbounds [[STRUCT_2]], %struct.2* [[START]], i64 6, i32 1, i64 [[IDX_EXT]]
342 ; CHECK-NEXT: [[START_0_CAST:%.*]] = bitcast i64* [[START_0]] to i8*
343 ; CHECK-NEXT: [[C_0:%.*]] = icmp ult i8* [[START_0_CAST]], [[HIGH]]
344 ; CHECK-NEXT: ret i1 [[C_0]]
346 ; CHECK-NEXT: ret i1 true
349 %idx.ext.plus.1 = add nuw nsw i32 %idx, 1
350 %idx.ext.plus.1.ext = zext i32 %idx.ext.plus.1 to i64
351 %add.ptr = getelementptr inbounds %struct.2, %struct.2* %start, i64 6, i32 1, i64 %idx.ext.plus.1.ext
352 %add.ptr.cast = bitcast i64* %add.ptr to i8*
353 %c.1 = icmp ule i8* %add.ptr.cast, %high
354 br i1 %c.1, label %if.then, label %if.end
356 if.then: ; preds = %entry
357 %idx.ext = zext i32 %idx to i64
358 %start.0 = getelementptr inbounds %struct.2, %struct.2* %start, i64 6, i32 1, i64 %idx.ext
359 %start.0.cast = bitcast i64* %start.0 to i8*
360 %c.0 = icmp ult i8* %start.0.cast, %high
363 if.end: ; preds = %entry
367 define i1 @ptr.int.struct.test.ult.due.to.second.dimension.var.index(%struct.2* %start, i8* %high, i32 %idx) {
368 ; CHECK-LABEL: @ptr.int.struct.test.ult.due.to.second.dimension.var.index(
370 ; CHECK-NEXT: [[IDX_EXT_PLUS_1:%.*]] = add nuw nsw i32 [[IDX:%.*]], 1
371 ; CHECK-NEXT: [[IDX_EXT_PLUS_1_EXT:%.*]] = zext i32 [[IDX_EXT_PLUS_1]] to i64
372 ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds [[STRUCT_2:%.*]], %struct.2* [[START:%.*]], i64 6, i32 1, i64 [[IDX_EXT_PLUS_1_EXT]]
373 ; CHECK-NEXT: [[ADD_PTR_CAST:%.*]] = bitcast i64* [[ADD_PTR]] to i8*
374 ; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8* [[ADD_PTR_CAST]], [[HIGH:%.*]]
375 ; CHECK-NEXT: br i1 [[C_1]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
377 ; CHECK-NEXT: [[IDX_EXT:%.*]] = zext i32 [[IDX]] to i64
378 ; CHECK-NEXT: [[START_0:%.*]] = getelementptr inbounds [[STRUCT_2]], %struct.2* [[START]], i64 6, i32 0
379 ; CHECK-NEXT: [[START_0_CAST:%.*]] = bitcast i32* [[START_0]] to i8*
380 ; CHECK-NEXT: [[C_0:%.*]] = icmp ult i8* [[START_0_CAST]], [[HIGH]]
381 ; CHECK-NEXT: ret i1 [[C_0]]
383 ; CHECK-NEXT: ret i1 true
386 %idx.ext.plus.1 = add nuw nsw i32 %idx, 1
387 %idx.ext.plus.1.ext = zext i32 %idx.ext.plus.1 to i64
388 %add.ptr = getelementptr inbounds %struct.2, %struct.2* %start, i64 6, i32 1, i64 %idx.ext.plus.1.ext
389 %add.ptr.cast = bitcast i64* %add.ptr to i8*
390 %c.1 = icmp ule i8* %add.ptr.cast, %high
391 br i1 %c.1, label %if.then, label %if.end
393 if.then: ; preds = %entry
394 %idx.ext = zext i32 %idx to i64
395 %start.0 = getelementptr inbounds %struct.2, %struct.2* %start, i64 6, i32 0
396 %start.0.cast = bitcast i32* %start.0 to i8*
397 %c.0 = icmp ult i8* %start.0.cast, %high
400 if.end: ; preds = %entry
404 define i1 @ptr.int.struct.test.ult.unknown.due.to.second.dimension.var.index(%struct.2* %start, i8* %high, i32 %idx) {
405 ; CHECK-LABEL: @ptr.int.struct.test.ult.unknown.due.to.second.dimension.var.index(
407 ; CHECK-NEXT: [[IDX_EXT_PLUS_1:%.*]] = add nuw nsw i32 [[IDX:%.*]], 1
408 ; CHECK-NEXT: [[IDX_EXT_PLUS_1_EXT:%.*]] = zext i32 [[IDX_EXT_PLUS_1]] to i64
409 ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds [[STRUCT_2:%.*]], %struct.2* [[START:%.*]], i64 6, i32 1, i64 [[IDX_EXT_PLUS_1_EXT]]
410 ; CHECK-NEXT: [[ADD_PTR_CAST:%.*]] = bitcast i64* [[ADD_PTR]] to i8*
411 ; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8* [[ADD_PTR_CAST]], [[HIGH:%.*]]
412 ; CHECK-NEXT: br i1 [[C_1]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
414 ; CHECK-NEXT: [[IDX_EXT:%.*]] = zext i32 [[IDX]] to i64
415 ; CHECK-NEXT: [[START_0:%.*]] = getelementptr inbounds [[STRUCT_2]], %struct.2* [[START]], i64 6, i32 2
416 ; CHECK-NEXT: [[C_0:%.*]] = icmp ult i8* [[START_0]], [[HIGH]]
417 ; CHECK-NEXT: ret i1 [[C_0]]
419 ; CHECK-NEXT: ret i1 true
422 %idx.ext.plus.1 = add nuw nsw i32 %idx, 1
423 %idx.ext.plus.1.ext = zext i32 %idx.ext.plus.1 to i64
424 %add.ptr = getelementptr inbounds %struct.2, %struct.2* %start, i64 6, i32 1, i64 %idx.ext.plus.1.ext
425 %add.ptr.cast = bitcast i64* %add.ptr to i8*
426 %c.1 = icmp ule i8* %add.ptr.cast, %high
427 br i1 %c.1, label %if.then, label %if.end
429 if.then: ; preds = %entry
430 %idx.ext = zext i32 %idx to i64
431 %start.0 = getelementptr inbounds %struct.2, %struct.2* %start, i64 6, i32 2
432 %c.0 = icmp ult i8* %start.0, %high
435 if.end: ; preds = %entry