1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -constraint-elimination -S %s | FileCheck %s
4 define void @pointer.to.array.test.ult.true.due.to.first.dimension([10 x i8]* %start, i8* %high) {
5 ; CHECK-LABEL: @pointer.to.array.test.ult.true.due.to.first.dimension(
7 ; CHECK-NEXT: [[ADD_PTR_I:%.*]] = getelementptr inbounds [10 x i8], [10 x i8]* [[START:%.*]], i64 9, i64 3
8 ; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8* [[ADD_PTR_I]], [[HIGH:%.*]]
9 ; CHECK-NEXT: br i1 [[C_1]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
11 ; CHECK-NEXT: [[START_0:%.*]] = getelementptr inbounds [10 x i8], [10 x i8]* [[START]], i64 5, i64 0
12 ; CHECK-NEXT: [[C_0:%.*]] = icmp ult i8* [[START_0]], [[HIGH]]
13 ; CHECK-NEXT: call void @use(i1 [[C_0]])
14 ; CHECK-NEXT: ret void
16 ; CHECK-NEXT: ret void
19 %add.ptr.i = getelementptr inbounds [10 x i8], [10 x i8]* %start, i64 9, i64 3
20 %c.1 = icmp ule i8* %add.ptr.i, %high
21 br i1 %c.1, label %if.then, label %if.end
23 if.then: ; preds = %entry
24 %start.0 = getelementptr inbounds [10 x i8], [10 x i8]* %start, i64 5, i64 0
25 %c.0 = icmp ult i8* %start.0, %high
26 call void @use(i1 %c.0)
30 if.end: ; preds = %entry
34 define void @pointer.to.array.test.ult.unknown.due.to.first.dimension([10 x i8]* %start, i8* %high) {
35 ; CHECK-LABEL: @pointer.to.array.test.ult.unknown.due.to.first.dimension(
37 ; CHECK-NEXT: [[ADD_PTR_I:%.*]] = getelementptr inbounds [10 x i8], [10 x i8]* [[START:%.*]], i64 5, i64 3
38 ; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8* [[ADD_PTR_I]], [[HIGH:%.*]]
39 ; CHECK-NEXT: br i1 [[C_1]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
41 ; CHECK-NEXT: [[START_0:%.*]] = getelementptr inbounds [10 x i8], [10 x i8]* [[START]], i64 10, i64 0
42 ; CHECK-NEXT: [[C_0:%.*]] = icmp ult i8* [[START_0]], [[HIGH]]
43 ; CHECK-NEXT: call void @use(i1 [[C_0]])
44 ; CHECK-NEXT: ret void
46 ; CHECK-NEXT: ret void
49 %add.ptr.i = getelementptr inbounds [10 x i8], [10 x i8]* %start, i64 5, i64 3
50 %c.1 = icmp ule i8* %add.ptr.i, %high
51 br i1 %c.1, label %if.then, label %if.end
53 if.then: ; preds = %entry
54 %start.0 = getelementptr inbounds [10 x i8], [10 x i8]* %start, i64 10, i64 0
55 %c.0 = icmp ult i8* %start.0, %high
56 call void @use(i1 %c.0)
60 if.end: ; preds = %entry
64 define void @pointer.to.array.test.ult.true.due.to.second.dimension([10 x i8]* %start, i8* %high) {
65 ; CHECK-LABEL: @pointer.to.array.test.ult.true.due.to.second.dimension(
67 ; CHECK-NEXT: [[ADD_PTR_I:%.*]] = getelementptr inbounds [10 x i8], [10 x i8]* [[START:%.*]], i64 5, i64 1
68 ; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8* [[ADD_PTR_I]], [[HIGH:%.*]]
69 ; CHECK-NEXT: br i1 [[C_1]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
71 ; CHECK-NEXT: [[START_0:%.*]] = getelementptr inbounds [10 x i8], [10 x i8]* [[START]], i64 5, i64 0
72 ; CHECK-NEXT: [[C_0:%.*]] = icmp ult i8* [[START_0]], [[HIGH]]
73 ; CHECK-NEXT: call void @use(i1 [[C_0]])
74 ; CHECK-NEXT: ret void
76 ; CHECK-NEXT: ret void
79 %add.ptr.i = getelementptr inbounds [10 x i8], [10 x i8]* %start, i64 5, i64 1
80 %c.1 = icmp ule i8* %add.ptr.i, %high
81 br i1 %c.1, label %if.then, label %if.end
83 if.then: ; preds = %entry
84 %start.0 = getelementptr inbounds [10 x i8], [10 x i8]* %start, i64 5, i64 0
85 %c.0 = icmp ult i8* %start.0, %high
86 call void @use(i1 %c.0)
90 if.end: ; preds = %entry
94 define void @pointer.to.array.test.ult.unknown.to.second.dimension([10 x i8]* %start, i8* %high) {
95 ; CHECK-LABEL: @pointer.to.array.test.ult.unknown.to.second.dimension(
97 ; CHECK-NEXT: [[ADD_PTR_I:%.*]] = getelementptr inbounds [10 x i8], [10 x i8]* [[START:%.*]], i64 5, i64 0
98 ; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8* [[ADD_PTR_I]], [[HIGH:%.*]]
99 ; CHECK-NEXT: br i1 [[C_1]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
101 ; CHECK-NEXT: [[START_0:%.*]] = getelementptr inbounds [10 x i8], [10 x i8]* [[START]], i64 5, i64 1
102 ; CHECK-NEXT: [[C_0:%.*]] = icmp ult i8* [[START_0]], [[HIGH]]
103 ; CHECK-NEXT: call void @use(i1 [[C_0]])
104 ; CHECK-NEXT: ret void
106 ; CHECK-NEXT: ret void
109 %add.ptr.i = getelementptr inbounds [10 x i8], [10 x i8]* %start, i64 5, i64 0
110 %c.1 = icmp ule i8* %add.ptr.i, %high
111 br i1 %c.1, label %if.then, label %if.end
113 if.then: ; preds = %entry
114 %start.0 = getelementptr inbounds [10 x i8], [10 x i8]* %start, i64 5, i64 1
115 %c.0 = icmp ult i8* %start.0, %high
116 call void @use(i1 %c.0)
120 if.end: ; preds = %entry
124 define void @pointer.to.array.test.not.uge.ult([10 x i8]* %start, i8* %high) {
125 ; CHECK-LABEL: @pointer.to.array.test.not.uge.ult(
127 ; CHECK-NEXT: [[ADD_PTR_I:%.*]] = getelementptr inbounds [10 x i8], [10 x i8]* [[START:%.*]], i64 1, i64 3
128 ; CHECK-NEXT: [[C_1:%.*]] = icmp uge i8* [[ADD_PTR_I]], [[HIGH:%.*]]
129 ; CHECK-NEXT: br i1 [[C_1]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
131 ; CHECK-NEXT: ret void
133 ; CHECK-NEXT: [[START_0:%.*]] = getelementptr inbounds [10 x i8], [10 x i8]* [[START]], i64 10, i64 0
134 ; CHECK-NEXT: [[C_0:%.*]] = icmp ult i8* [[START_0]], [[HIGH]]
135 ; CHECK-NEXT: call void @use(i1 [[C_0]])
136 ; CHECK-NEXT: ret void
139 %add.ptr.i = getelementptr inbounds [10 x i8], [10 x i8]* %start, i64 1, i64 3
140 %c.1 = icmp uge i8* %add.ptr.i, %high
141 br i1 %c.1, label %if.then, label %if.end
143 if.then: ; preds = %entry
146 if.end: ; preds = %entry
147 %start.0 = getelementptr inbounds [10 x i8], [10 x i8]* %start, i64 10, i64 0
148 %c.0 = icmp ult i8* %start.0, %high
149 call void @use(i1 %c.0)
153 define void @pointer.to.array.test.not.uge.ule([10 x i8]* %start, i8* %high) {
154 ; CHECK-LABEL: @pointer.to.array.test.not.uge.ule(
156 ; CHECK-NEXT: [[ADD_PTR_I:%.*]] = getelementptr inbounds [10 x i8], [10 x i8]* [[START:%.*]], i64 1, i64 3
157 ; CHECK-NEXT: [[C:%.*]] = icmp uge i8* [[ADD_PTR_I]], [[HIGH:%.*]]
158 ; CHECK-NEXT: br i1 [[C]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
160 ; CHECK-NEXT: ret void
162 ; CHECK-NEXT: [[START_0:%.*]] = getelementptr inbounds [10 x i8], [10 x i8]* [[START]], i64 10, i64 0
163 ; CHECK-NEXT: [[C_0:%.*]] = icmp ule i8* [[START_0]], [[HIGH]]
164 ; CHECK-NEXT: call void @use(i1 [[C_0]])
165 ; CHECK-NEXT: [[START_1:%.*]] = getelementptr inbounds [10 x i8], [10 x i8]* [[START]], i64 2, i64 1
166 ; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8* [[START_1]], [[HIGH]]
167 ; CHECK-NEXT: call void @use(i1 [[C_1]])
168 ; CHECK-NEXT: ret void
171 %add.ptr.i = getelementptr inbounds [10 x i8], [10 x i8]* %start, i64 1, i64 3
172 %c = icmp uge i8* %add.ptr.i, %high
173 br i1 %c, label %if.then, label %if.end
175 if.then: ; preds = %entry
178 if.end: ; preds = %entry
179 %start.0 = getelementptr inbounds [10 x i8], [10 x i8]* %start, i64 10, i64 0
180 %c.0 = icmp ule i8* %start.0, %high
181 call void @use(i1 %c.0)
182 %start.1 = getelementptr inbounds [10 x i8], [10 x i8]* %start, i64 2, i64 1
183 %c.1 = icmp ule i8* %start.1, %high
184 call void @use(i1 %c.1)
188 define void @pointer.to.array.test.not.uge.ugt([10 x i8]* %start, i8* %high) {
189 ; CHECK-LABEL: @pointer.to.array.test.not.uge.ugt(
191 ; CHECK-NEXT: [[ADD_PTR_I:%.*]] = getelementptr inbounds [10 x i8], [10 x i8]* [[START:%.*]], i64 1, i64 3
192 ; CHECK-NEXT: [[C:%.*]] = icmp uge i8* [[ADD_PTR_I]], [[HIGH:%.*]]
193 ; CHECK-NEXT: br i1 [[C]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
195 ; CHECK-NEXT: ret void
197 ; CHECK-NEXT: [[START_0:%.*]] = getelementptr inbounds [10 x i8], [10 x i8]* [[START]], i64 3, i64 0
198 ; CHECK-NEXT: [[C_0:%.*]] = icmp ugt i8* [[START_0]], [[HIGH]]
199 ; CHECK-NEXT: call void @use(i1 [[C_0]])
200 ; CHECK-NEXT: [[START_1:%.*]] = getelementptr inbounds [10 x i8], [10 x i8]* [[START]], i64 3, i64 1
201 ; CHECK-NEXT: [[C_1:%.*]] = icmp ugt i8* [[START_1]], [[HIGH]]
202 ; CHECK-NEXT: call void @use(i1 [[C_1]])
203 ; CHECK-NEXT: ret void
206 %add.ptr.i = getelementptr inbounds [10 x i8], [10 x i8]* %start, i64 1, i64 3
207 %c = icmp uge i8* %add.ptr.i, %high
208 br i1 %c, label %if.then, label %if.end
210 if.then: ; preds = %entry
213 if.end: ; preds = %entry
214 %start.0 = getelementptr inbounds [10 x i8], [10 x i8]* %start, i64 3, i64 0
215 %c.0 = icmp ugt i8* %start.0, %high
216 call void @use(i1 %c.0)
218 %start.1 = getelementptr inbounds [10 x i8], [10 x i8]* %start, i64 3, i64 1
219 %c.1 = icmp ugt i8* %start.1, %high
220 call void @use(i1 %c.1)
224 define void @pointer.to.array.test.not.uge.uge([10 x i8]* %start, i8* %high) {
225 ; CHECK-LABEL: @pointer.to.array.test.not.uge.uge(
227 ; CHECK-NEXT: [[ADD_PTR_I:%.*]] = getelementptr inbounds [10 x i8], [10 x i8]* [[START:%.*]], i64 1, i64 3
228 ; CHECK-NEXT: [[C_1:%.*]] = icmp uge i8* [[ADD_PTR_I]], [[HIGH:%.*]]
229 ; CHECK-NEXT: br i1 [[C_1]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
231 ; CHECK-NEXT: ret void
233 ; CHECK-NEXT: [[START_0:%.*]] = getelementptr inbounds [10 x i8], [10 x i8]* [[START]], i64 3, i64 0
234 ; CHECK-NEXT: [[C_0:%.*]] = icmp uge i8* [[START_0]], [[HIGH]]
235 ; CHECK-NEXT: call void @use(i1 [[C_0]])
236 ; CHECK-NEXT: ret void
239 %add.ptr.i = getelementptr inbounds [10 x i8], [10 x i8]* %start, i64 1, i64 3
240 %c.1 = icmp uge i8* %add.ptr.i, %high
241 br i1 %c.1, label %if.then, label %if.end
243 if.then: ; preds = %entry
246 if.end: ; preds = %entry
247 %start.0 = getelementptr inbounds [10 x i8], [10 x i8]* %start, i64 3, i64 0
248 %c.0 = icmp uge i8* %start.0, %high
249 call void @use(i1 %c.0)
254 declare void @use(i1)