1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt -passes=constraint-elimination -S %s | FileCheck %s
3
4target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
5
6define i1 @test_outer_gep_last_index_no_overflow_all_inbounds_1(ptr %dst) {
7; CHECK-LABEL: @test_outer_gep_last_index_no_overflow_all_inbounds_1(
8; CHECK-NEXT:    [[DST_0:%.*]] = getelementptr inbounds ptr, ptr [[DST:%.*]], i64 0
9; CHECK-NEXT:    [[UPPER:%.*]] = getelementptr inbounds ptr, ptr [[DST]], i64 2
10; CHECK-NEXT:    [[GEP_1:%.*]] = getelementptr inbounds [2 x i32], ptr [[DST_0]], i64 1, i64 1
11; CHECK-NEXT:    [[C_1:%.*]] = icmp slt ptr [[GEP_1]], [[UPPER]]
12; CHECK-NEXT:    ret i1 [[C_1]]
13;
14  %dst.0 = getelementptr inbounds ptr, ptr %dst, i64 0
15  %upper = getelementptr inbounds ptr, ptr %dst, i64 2
16  %gep.1 = getelementptr inbounds [2 x i32] , ptr %dst.0, i64 1, i64 1
17  %c.1 = icmp slt ptr %gep.1, %upper
18  ret i1 %c.1
19}
20
21define i1 @test_outer_gep_last_index_no_overflow_all_inbounds_2(ptr %dst) {
22; CHECK-LABEL: @test_outer_gep_last_index_no_overflow_all_inbounds_2(
23; CHECK-NEXT:    [[DST_0:%.*]] = getelementptr inbounds ptr, ptr [[DST:%.*]], i64 0
24; CHECK-NEXT:    [[UPPER:%.*]] = getelementptr inbounds ptr, ptr [[DST]], i64 3
25; CHECK-NEXT:    [[GEP_1:%.*]] = getelementptr inbounds [2 x i32], ptr [[DST_0]], i64 1, i64 1
26; CHECK-NEXT:    [[C_1:%.*]] = icmp slt ptr [[GEP_1]], [[UPPER]]
27; CHECK-NEXT:    ret i1 [[C_1]]
28;
29  %dst.0 = getelementptr inbounds ptr, ptr %dst, i64 0
30  %upper = getelementptr inbounds ptr, ptr %dst, i64 3
31  %gep.1 = getelementptr inbounds [2 x i32] , ptr %dst.0, i64 1, i64 1
32  %c.1 = icmp slt ptr %gep.1, %upper
33  ret i1 %c.1
34}
35
36define i1 @test_outer_gep_last_index_overflow_all_inbounds(ptr %dst) {
37; CHECK-LABEL: @test_outer_gep_last_index_overflow_all_inbounds(
38; CHECK-NEXT:    [[DST_0:%.*]] = getelementptr inbounds ptr, ptr [[DST:%.*]], i64 0
39; CHECK-NEXT:    [[UPPER:%.*]] = getelementptr inbounds ptr, ptr [[DST]], i64 2
40; CHECK-NEXT:    [[GEP_1:%.*]] = getelementptr inbounds [2 x i32], ptr [[DST_0]], i64 1, i64 2
41; CHECK-NEXT:    [[C:%.*]] = icmp slt ptr [[GEP_1]], [[UPPER]]
42; CHECK-NEXT:    ret i1 [[C]]
43;
44  %dst.0 = getelementptr inbounds ptr, ptr %dst, i64 0
45  %upper = getelementptr inbounds ptr, ptr %dst, i64 2
46  %gep.1 = getelementptr inbounds [2 x i32] , ptr %dst.0, i64 1, i64 2
47  %c = icmp slt ptr %gep.1, %upper
48  ret i1 %c
49}
50
51define i1 @test_inner_gep_multiple_indices_ult_true_all_inbounds(ptr %dst) {
52; CHECK-LABEL: @test_inner_gep_multiple_indices_ult_true_all_inbounds(
53; CHECK-NEXT:    [[DST_0:%.*]] = getelementptr inbounds [2 x i32], ptr [[DST:%.*]], i64 0, i64 0
54; CHECK-NEXT:    [[UPPER:%.*]] = getelementptr inbounds [2 x i32], ptr [[DST]], i64 0, i64 2
55; CHECK-NEXT:    [[GEP_1:%.*]] = getelementptr inbounds i32, ptr [[DST_0]], i64 1
56; CHECK-NEXT:    [[C:%.*]] = icmp slt ptr [[GEP_1]], [[UPPER]]
57; CHECK-NEXT:    ret i1 [[C]]
58;
59  %dst.0 = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 0
60  %upper = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 2
61  %gep.1 = getelementptr inbounds i32, ptr %dst.0, i64 1
62  %c = icmp slt ptr %gep.1, %upper
63  ret i1 %c
64}
65
66define i1 @test_inner_gep_multiple_indices_uge_true_all_inbounds(ptr %dst) {
67; CHECK-LABEL: @test_inner_gep_multiple_indices_uge_true_all_inbounds(
68; CHECK-NEXT:    [[DST_0:%.*]] = getelementptr inbounds [2 x i32], ptr [[DST:%.*]], i64 0, i64 0
69; CHECK-NEXT:    [[UPPER:%.*]] = getelementptr inbounds [2 x i32], ptr [[DST]], i64 0, i64 2
70; CHECK-NEXT:    [[GEP_1:%.*]] = getelementptr inbounds i32, ptr [[DST_0]], i64 1
71; CHECK-NEXT:    [[C:%.*]] = icmp sge ptr [[GEP_1]], [[DST_0]]
72; CHECK-NEXT:    ret i1 [[C]]
73;
74  %dst.0 = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 0
75  %upper = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 2
76  %gep.1 = getelementptr inbounds i32, ptr %dst.0, i64 1
77  %c = icmp sge ptr %gep.1, %dst.0
78  ret i1 %c
79}
80
81define i1 @test_inner_gep_multiple_indices_ult_false_all_inbounds(ptr %dst) {
82; CHECK-LABEL: @test_inner_gep_multiple_indices_ult_false_all_inbounds(
83; CHECK-NEXT:  entry:
84; CHECK-NEXT:    [[DST_0:%.*]] = getelementptr inbounds [2 x i32], ptr [[DST:%.*]], i64 0, i64 0
85; CHECK-NEXT:    [[UPPER:%.*]] = getelementptr inbounds [2 x i32], ptr [[DST]], i64 0, i64 2
86; CHECK-NEXT:    [[GEP_1:%.*]] = getelementptr inbounds i32, ptr [[DST_0]], i64 2
87; CHECK-NEXT:    [[C:%.*]] = icmp slt ptr [[GEP_1]], [[UPPER]]
88; CHECK-NEXT:    ret i1 [[C]]
89;
90entry:
91  %dst.0 = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 0
92  %upper = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 2
93  %gep.1 = getelementptr inbounds i32, ptr %dst.0, i64 2
94  %c = icmp slt ptr %gep.1, %upper
95  ret i1 %c
96}
97
98define i1 @test_inner_gep_multiple_indices_uge_true_all_inbounds_2(ptr %dst) {
99; CHECK-LABEL: @test_inner_gep_multiple_indices_uge_true_all_inbounds_2(
100; CHECK-NEXT:  entry:
101; CHECK-NEXT:    [[DST_0:%.*]] = getelementptr inbounds [2 x i32], ptr [[DST:%.*]], i64 0, i64 0
102; CHECK-NEXT:    [[UPPER:%.*]] = getelementptr inbounds [2 x i32], ptr [[DST]], i64 0, i64 2
103; CHECK-NEXT:    [[GEP_1:%.*]] = getelementptr inbounds i32, ptr [[DST_0]], i64 2
104; CHECK-NEXT:    [[C:%.*]] = icmp sge ptr [[GEP_1]], [[DST_0]]
105; CHECK-NEXT:    ret i1 [[C]]
106;
107entry:
108  %dst.0 = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 0
109  %upper = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 2
110  %gep.1 = getelementptr inbounds i32, ptr %dst.0, i64 2
111  %c = icmp sge ptr %gep.1, %dst.0
112  ret i1 %c
113}
114
115define i1 @test_inner_gep_multiple_indices_ult_true_inc_gep_all_inbounds_overflow(ptr %dst) {
116; CHECK-LABEL: @test_inner_gep_multiple_indices_ult_true_inc_gep_all_inbounds_overflow(
117; CHECK-NEXT:  entry:
118; CHECK-NEXT:    [[DST_0:%.*]] = getelementptr inbounds [2 x i32], ptr [[DST:%.*]], i64 0, i64 0
119; CHECK-NEXT:    [[UPPER:%.*]] = getelementptr inbounds [2 x i32], ptr [[DST]], i64 0, i64 6
120; CHECK-NEXT:    [[GEP_1:%.*]] = getelementptr i32, ptr [[DST_0]], i64 2
121; CHECK-NEXT:    [[C:%.*]] = icmp slt ptr [[GEP_1]], [[UPPER]]
122; CHECK-NEXT:    ret i1 [[C]]
123;
124entry:
125  %dst.0 = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 0
126  %upper = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 6
127  %gep.1 = getelementptr i32, ptr %dst.0, i64 2
128  %c = icmp slt ptr %gep.1, %upper
129  ret i1 %c
130}
131
132define i1 @test_inner_gep_multiple_indices_ult_true_inc_gep_not_inbounds(ptr %dst) {
133; CHECK-LABEL: @test_inner_gep_multiple_indices_ult_true_inc_gep_not_inbounds(
134; CHECK-NEXT:  entry:
135; CHECK-NEXT:    [[DST_0:%.*]] = getelementptr inbounds [2 x i32], ptr [[DST:%.*]], i64 0, i64 0
136; CHECK-NEXT:    [[UPPER:%.*]] = getelementptr inbounds [2 x i32], ptr [[DST]], i64 0, i64 2
137; CHECK-NEXT:    [[GEP_1:%.*]] = getelementptr i32, ptr [[DST_0]], i64 1
138; CHECK-NEXT:    [[C:%.*]] = icmp slt ptr [[GEP_1]], [[UPPER]]
139; CHECK-NEXT:    ret i1 [[C]]
140;
141entry:
142  %dst.0 = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 0
143  %upper = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 2
144  %gep.1 = getelementptr i32, ptr %dst.0, i64 1
145  %c = icmp slt ptr %gep.1, %upper
146  ret i1 %c
147}
148
149define i1 @test_inner_gep_multiple_indices_uge_true_inc_gep_not_inbounds(ptr %dst) {
150; CHECK-LABEL: @test_inner_gep_multiple_indices_uge_true_inc_gep_not_inbounds(
151; CHECK-NEXT:  entry:
152; CHECK-NEXT:    [[DST_0:%.*]] = getelementptr inbounds [2 x i32], ptr [[DST:%.*]], i64 0, i64 0
153; CHECK-NEXT:    [[UPPER:%.*]] = getelementptr inbounds [2 x i32], ptr [[DST]], i64 0, i64 2
154; CHECK-NEXT:    [[GEP_1:%.*]] = getelementptr i32, ptr [[DST_0]], i64 1
155; CHECK-NEXT:    [[C:%.*]] = icmp slt ptr [[GEP_1]], [[UPPER]]
156; CHECK-NEXT:    ret i1 [[C]]
157;
158entry:
159  %dst.0 = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 0
160  %upper = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 2
161  %gep.1 = getelementptr i32, ptr %dst.0, i64 1
162  %c = icmp slt ptr %gep.1, %upper
163  ret i1 %c
164}
165
166define i1 @test_inner_gep_multiple_indices_ult_false_inc_gep_not_inbounds(ptr %dst) {
167; CHECK-LABEL: @test_inner_gep_multiple_indices_ult_false_inc_gep_not_inbounds(
168; CHECK-NEXT:  entry:
169; CHECK-NEXT:    [[DST_0:%.*]] = getelementptr inbounds [2 x i32], ptr [[DST:%.*]], i64 0, i64 0
170; CHECK-NEXT:    [[UPPER:%.*]] = getelementptr inbounds [2 x i32], ptr [[DST]], i64 0, i64 2
171; CHECK-NEXT:    [[GEP_1:%.*]] = getelementptr i32, ptr [[DST_0]], i64 2
172; CHECK-NEXT:    [[C:%.*]] = icmp slt ptr [[GEP_1]], [[UPPER]]
173; CHECK-NEXT:    ret i1 [[C]]
174;
175entry:
176  %dst.0 = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 0
177  %upper = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 2
178  %gep.1 = getelementptr i32, ptr %dst.0, i64 2
179  %c = icmp slt ptr %gep.1, %upper
180  ret i1 %c
181}
182
183define i1 @test_inner_gep_multiple_indices_ult_true_inc_gep_not_inbounds_overflow(ptr %dst) {
184; CHECK-LABEL: @test_inner_gep_multiple_indices_ult_true_inc_gep_not_inbounds_overflow(
185; CHECK-NEXT:  entry:
186; CHECK-NEXT:    [[DST_0:%.*]] = getelementptr inbounds [2 x i32], ptr [[DST:%.*]], i64 0, i64 0
187; CHECK-NEXT:    [[UPPER:%.*]] = getelementptr inbounds [2 x i32], ptr [[DST]], i64 0, i64 5
188; CHECK-NEXT:    [[GEP_1:%.*]] = getelementptr i32, ptr [[DST_0]], i64 2
189; CHECK-NEXT:    [[C:%.*]] = icmp slt ptr [[GEP_1]], [[UPPER]]
190; CHECK-NEXT:    ret i1 [[C]]
191;
192entry:
193  %dst.0 = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 0
194  %upper = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 5
195  %gep.1 = getelementptr i32, ptr %dst.0, i64 2
196  %c = icmp slt ptr %gep.1, %upper
197  ret i1 %c
198}
199
200define i1 @test_inner_gep_multi_index(ptr %dst) {
201; CHECK-LABEL: @test_inner_gep_multi_index(
202; CHECK-NEXT:    [[DST_0:%.*]] = getelementptr inbounds ptr, ptr [[DST:%.*]], i64 0
203; CHECK-NEXT:    [[UPPER:%.*]] = getelementptr inbounds ptr, ptr [[DST]], i64 2
204; CHECK-NEXT:    [[GEP_1:%.*]] = getelementptr inbounds [2 x i32], ptr [[DST_0]], i64 1, i64 1
205; CHECK-NEXT:    [[C_1:%.*]] = icmp slt ptr [[GEP_1]], [[UPPER]]
206; CHECK-NEXT:    ret i1 [[C_1]]
207;
208  %dst.0 = getelementptr inbounds ptr, ptr %dst, i64 0
209  %upper = getelementptr inbounds ptr, ptr %dst, i64 2
210  %gep.1 = getelementptr inbounds [2 x i32] , ptr %dst.0, i64 1, i64 1
211  %c.1 = icmp slt ptr %gep.1, %upper
212  ret i1 %c.1
213}
214
215define i1 @test_inner_gep_multi_index_outer_gep_last_index_no_overflow_all_inbounds(ptr %dst) {
216; CHECK-LABEL: @test_inner_gep_multi_index_outer_gep_last_index_no_overflow_all_inbounds(
217; CHECK-NEXT:    [[DST_0:%.*]] = getelementptr inbounds [2 x i32], ptr [[DST:%.*]], i64 0, i64 0
218; CHECK-NEXT:    [[UPPER:%.*]] = getelementptr inbounds ptr, ptr [[DST]], i64 2
219; CHECK-NEXT:    [[GEP_1:%.*]] = getelementptr inbounds [2 x i32], ptr [[DST_0]], i64 1, i64 1
220; CHECK-NEXT:    [[C_1:%.*]] = icmp slt ptr [[GEP_1]], [[UPPER]]
221; CHECK-NEXT:    ret i1 [[C_1]]
222;
223  %dst.0 = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 0
224  %upper = getelementptr inbounds ptr, ptr %dst, i64 2
225  %gep.1 = getelementptr inbounds [2 x i32] , ptr %dst.0, i64 1, i64 1
226  %c.1 = icmp slt ptr %gep.1, %upper
227  ret i1 %c.1
228}
229
230define i1 @test_inner_gep_multi_index_no_overflow_all_inbounds_1(ptr %dst) {
231; CHECK-LABEL: @test_inner_gep_multi_index_no_overflow_all_inbounds_1(
232; CHECK-NEXT:    [[DST_0:%.*]] = getelementptr inbounds [2 x i32], ptr [[DST:%.*]], i64 0, i64 1
233; CHECK-NEXT:    [[UPPER:%.*]] = getelementptr inbounds i32, ptr [[DST]], i64 2
234; CHECK-NEXT:    [[GEP_1:%.*]] = getelementptr inbounds i32, ptr [[DST_0]], i64 1
235; CHECK-NEXT:    [[C_1:%.*]] = icmp slt ptr [[GEP_1]], [[UPPER]]
236; CHECK-NEXT:    ret i1 [[C_1]]
237;
238  %dst.0 = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 1
239  %upper = getelementptr inbounds i32, ptr %dst, i64 2
240  %gep.1 = getelementptr inbounds i32, ptr %dst.0, i64 1
241  %c.1 = icmp slt ptr %gep.1, %upper
242  ret i1 %c.1
243}
244
245define i1 @test_inner_gep_multi_index_no_overflow_all_inbounds_2(ptr %dst) {
246; CHECK-LABEL: @test_inner_gep_multi_index_no_overflow_all_inbounds_2(
247; CHECK-NEXT:    [[DST_0:%.*]] = getelementptr inbounds [2 x i32], ptr [[DST:%.*]], i64 1, i64 0
248; CHECK-NEXT:    [[UPPER:%.*]] = getelementptr inbounds i32, ptr [[DST]], i64 2
249; CHECK-NEXT:    [[GEP_1:%.*]] = getelementptr inbounds i32, ptr [[DST_0]], i64 1
250; CHECK-NEXT:    [[C_1:%.*]] = icmp slt ptr [[GEP_1]], [[UPPER]]
251; CHECK-NEXT:    ret i1 [[C_1]]
252;
253  %dst.0 = getelementptr inbounds [2 x i32], ptr %dst, i64 1, i64 0
254  %upper = getelementptr inbounds i32, ptr %dst, i64 2
255  %gep.1 = getelementptr inbounds i32, ptr %dst.0, i64 1
256  %c.1 = icmp slt ptr %gep.1, %upper
257  ret i1 %c.1
258}
259
260define i1 @test_inner_gep_multi_index_no_overflow_all_inbounds_3(ptr %dst) {
261; CHECK-LABEL: @test_inner_gep_multi_index_no_overflow_all_inbounds_3(
262; CHECK-NEXT:    [[DST_0:%.*]] = getelementptr inbounds [2 x i32], ptr [[DST:%.*]], i64 1, i64 0
263; CHECK-NEXT:    [[UPPER:%.*]] = getelementptr inbounds i32, ptr [[DST]], i64 3
264; CHECK-NEXT:    [[GEP_1:%.*]] = getelementptr inbounds i32, ptr [[DST_0]], i64 1
265; CHECK-NEXT:    [[C_1:%.*]] = icmp slt ptr [[GEP_1]], [[UPPER]]
266; CHECK-NEXT:    ret i1 [[C_1]]
267;
268  %dst.0 = getelementptr inbounds [2 x i32], ptr %dst, i64 1, i64 0
269  %upper = getelementptr inbounds i32, ptr %dst, i64 3
270  %gep.1 = getelementptr inbounds i32, ptr %dst.0, i64 1
271  %c.1 = icmp slt ptr %gep.1, %upper
272  ret i1 %c.1
273}
274
275define i1 @test_inner_gep_multi_index_no_overflow_all_inbounds_4(ptr %dst) {
276; CHECK-LABEL: @test_inner_gep_multi_index_no_overflow_all_inbounds_4(
277; CHECK-NEXT:    [[DST_0:%.*]] = getelementptr inbounds [2 x i32], ptr [[DST:%.*]], i64 1, i64 0
278; CHECK-NEXT:    [[UPPER:%.*]] = getelementptr inbounds i32, ptr [[DST]], i64 4
279; CHECK-NEXT:    [[GEP_1:%.*]] = getelementptr inbounds i32, ptr [[DST_0]], i64 1
280; CHECK-NEXT:    [[C_1:%.*]] = icmp slt ptr [[GEP_1]], [[UPPER]]
281; CHECK-NEXT:    ret i1 [[C_1]]
282;
283  %dst.0 = getelementptr inbounds [2 x i32], ptr %dst, i64 1, i64 0
284  %upper = getelementptr inbounds i32, ptr %dst, i64 4
285  %gep.1 = getelementptr inbounds i32, ptr %dst.0, i64 1
286  %c.1 = icmp slt ptr %gep.1, %upper
287  ret i1 %c.1
288}
289
290define i1 @test_inner_gep_multi_index_no_overflow_all_inbounds_5(i64 %off, ptr %dst) {
291; CHECK-LABEL: @test_inner_gep_multi_index_no_overflow_all_inbounds_5(
292; CHECK-NEXT:    [[OFF_ULT:%.*]] = icmp sle i64 [[OFF:%.*]], 2
293; CHECK-NEXT:    [[DST_0:%.*]] = getelementptr inbounds [2 x i32], ptr [[DST:%.*]], i64 2, i64 0
294; CHECK-NEXT:    [[UPPER:%.*]] = getelementptr inbounds i32, ptr [[DST]], i64 5
295; CHECK-NEXT:    [[GEP_1:%.*]] = getelementptr inbounds i32, ptr [[DST_0]], i64 1
296; CHECK-NEXT:    [[C_1:%.*]] = icmp sle ptr [[GEP_1]], [[UPPER]]
297; CHECK-NEXT:    ret i1 [[C_1]]
298;
299  %off.ult = icmp sle i64 %off, 2
300  %dst.0 = getelementptr inbounds [2 x i32], ptr %dst, i64 2, i64 0
301  %upper = getelementptr inbounds i32, ptr %dst, i64 5
302  %gep.1 = getelementptr inbounds i32, ptr %dst.0, i64 1
303  %c.1 = icmp sle ptr %gep.1, %upper
304  ret i1 %c.1
305}
306
307define i1 @test_inner_gep_multi_index_no_overflow_all_inbounds_6(i64 %off, ptr %dst) {
308; CHECK-LABEL: @test_inner_gep_multi_index_no_overflow_all_inbounds_6(
309; CHECK-NEXT:    [[OFF_ULT:%.*]] = icmp sle i64 [[OFF:%.*]], 2
310; CHECK-NEXT:    [[DST_0:%.*]] = getelementptr inbounds [2 x i32], ptr [[DST:%.*]], i64 2, i64 0
311; CHECK-NEXT:    [[UPPER:%.*]] = getelementptr inbounds i32, ptr [[DST]], i64 5
312; CHECK-NEXT:    [[GEP_1:%.*]] = getelementptr inbounds i32, ptr [[DST_0]], i64 1
313; CHECK-NEXT:    [[C_1:%.*]] = icmp slt ptr [[GEP_1]], [[UPPER]]
314; CHECK-NEXT:    ret i1 [[C_1]]
315;
316  %off.ult = icmp sle i64 %off, 2
317  %dst.0 = getelementptr inbounds [2 x i32], ptr %dst, i64 2, i64 0
318  %upper = getelementptr inbounds i32, ptr %dst, i64 5
319  %gep.1 = getelementptr inbounds i32, ptr %dst.0, i64 1
320  %c.1 = icmp slt ptr %gep.1, %upper
321  ret i1 %c.1
322}
323
324define i1 @test_inner_gep_multi_index_no_overflow_all_inbounds_7(i64 %off, ptr %dst) {
325; CHECK-LABEL: @test_inner_gep_multi_index_no_overflow_all_inbounds_7(
326; CHECK-NEXT:    [[OFF_ULT:%.*]] = icmp sle i64 [[OFF:%.*]], 2
327; CHECK-NEXT:    [[DST_0:%.*]] = getelementptr inbounds [2 x i32], ptr [[DST:%.*]], i64 2, i64 0
328; CHECK-NEXT:    [[UPPER:%.*]] = getelementptr inbounds i32, ptr [[DST]], i64 [[OFF]]
329; CHECK-NEXT:    [[GEP_1:%.*]] = getelementptr inbounds i32, ptr [[DST_0]], i64 1
330; CHECK-NEXT:    [[C_1:%.*]] = icmp slt ptr [[GEP_1]], [[UPPER]]
331; CHECK-NEXT:    ret i1 [[C_1]]
332;
333  %off.ult = icmp sle i64 %off, 2
334  %dst.0 = getelementptr inbounds [2 x i32], ptr %dst, i64 2, i64 0
335  %upper = getelementptr inbounds i32, ptr %dst, i64 %off
336  %gep.1 = getelementptr inbounds i32, ptr %dst.0, i64 1
337  %c.1 = icmp slt ptr %gep.1, %upper
338  ret i1 %c.1
339}
340