@@ -143,6 +143,44 @@ define i1 @ult_base_nusw(ptr %x, i64 %y) {
143
143
ret i1 %r
144
144
}
145
145
146
+ define i1 @ugt_base_nuw (ptr %x , i64 %y ) {
147
+ ; CHECK-LABEL: @ugt_base_nuw(
148
+ ; CHECK-NEXT: [[R:%.*]] = icmp ne i64 [[Y:%.*]], 0
149
+ ; CHECK-NEXT: ret i1 [[R]]
150
+ ;
151
+ %g = getelementptr nuw i8 , ptr %x , i64 %y
152
+ %r = icmp ugt ptr %g , %x
153
+ ret i1 %r
154
+ }
155
+
156
+ define i1 @ugt_base_nusw_nuw (ptr %x , i64 %y ) {
157
+ ; CHECK-LABEL: @ugt_base_nusw_nuw(
158
+ ; CHECK-NEXT: [[R:%.*]] = icmp ne i64 [[Y:%.*]], 0
159
+ ; CHECK-NEXT: ret i1 [[R]]
160
+ ;
161
+ %g = getelementptr nusw nuw i8 , ptr %x , i64 %y
162
+ %r = icmp ugt ptr %g , %x
163
+ ret i1 %r
164
+ }
165
+
166
+ define i1 @uge_base_nuw (ptr %x , i64 %y ) {
167
+ ; CHECK-LABEL: @uge_base_nuw(
168
+ ; CHECK-NEXT: ret i1 true
169
+ ;
170
+ %g = getelementptr nuw i8 , ptr %x , i64 %y
171
+ %r = icmp uge ptr %g , %x
172
+ ret i1 %r
173
+ }
174
+
175
+ define i1 @uge_base_nusw_nuw (ptr %x , i64 %y ) {
176
+ ; CHECK-LABEL: @uge_base_nusw_nuw(
177
+ ; CHECK-NEXT: ret i1 true
178
+ ;
179
+ %g = getelementptr nusw nuw i8 , ptr %x , i64 %y
180
+ %r = icmp uge ptr %g , %x
181
+ ret i1 %r
182
+ }
183
+
146
184
define i1 @ugt_base_inbounds_commute (i64 %y ) {
147
185
; CHECK-LABEL: @ugt_base_inbounds_commute(
148
186
; CHECK-NEXT: [[X:%.*]] = call ptr @getptr()
@@ -319,6 +357,43 @@ define i1 @test60_nusw_inbounds(ptr %foo, i64 %i, i64 %j) {
319
357
ret i1 %cmp
320
358
}
321
359
360
+ define i1 @test60_nuw (ptr %foo , i64 %i , i64 %j ) {
361
+ ; CHECK-LABEL: @test60_nuw(
362
+ ; CHECK-NEXT: [[GEP1_IDX:%.*]] = shl nuw i64 [[I:%.*]], 2
363
+ ; CHECK-NEXT: [[CMP:%.*]] = icmp ult i64 [[GEP1_IDX]], [[J:%.*]]
364
+ ; CHECK-NEXT: ret i1 [[CMP]]
365
+ ;
366
+ %gep1 = getelementptr nuw i32 , ptr %foo , i64 %i
367
+ %gep2 = getelementptr nuw i8 , ptr %foo , i64 %j
368
+ %cmp = icmp ult ptr %gep1 , %gep2
369
+ ret i1 %cmp
370
+ }
371
+
372
+ define i1 @test60_nusw_nuw (ptr %foo , i64 %i , i64 %j ) {
373
+ ; CHECK-LABEL: @test60_nusw_nuw(
374
+ ; CHECK-NEXT: [[GEP1_IDX:%.*]] = shl nuw nsw i64 [[I:%.*]], 2
375
+ ; CHECK-NEXT: [[CMP:%.*]] = icmp samesign ult i64 [[GEP1_IDX]], [[J:%.*]]
376
+ ; CHECK-NEXT: ret i1 [[CMP]]
377
+ ;
378
+ %gep1 = getelementptr nusw nuw i32 , ptr %foo , i64 %i
379
+ %gep2 = getelementptr nusw nuw i8 , ptr %foo , i64 %j
380
+ %cmp = icmp ult ptr %gep1 , %gep2
381
+ ret i1 %cmp
382
+ }
383
+
384
+ define i1 @test60_nusw_nuw_mix (ptr %foo , i64 %i , i64 %j ) {
385
+ ; CHECK-LABEL: @test60_nusw_nuw_mix(
386
+ ; CHECK-NEXT: [[GEP1:%.*]] = getelementptr nuw i32, ptr [[FOO:%.*]], i64 [[I:%.*]]
387
+ ; CHECK-NEXT: [[GEP2:%.*]] = getelementptr nusw i8, ptr [[FOO]], i64 [[J:%.*]]
388
+ ; CHECK-NEXT: [[CMP:%.*]] = icmp ult ptr [[GEP1]], [[GEP2]]
389
+ ; CHECK-NEXT: ret i1 [[CMP]]
390
+ ;
391
+ %gep1 = getelementptr nuw i32 , ptr %foo , i64 %i
392
+ %gep2 = getelementptr nusw i8 , ptr %foo , i64 %j
393
+ %cmp = icmp ult ptr %gep1 , %gep2
394
+ ret i1 %cmp
395
+ }
396
+
322
397
define i1 @test_gep_ult_no_inbounds (ptr %foo , i64 %i , i64 %j ) {
323
398
; CHECK-LABEL: @test_gep_ult_no_inbounds(
324
399
; CHECK-NEXT: [[GEP1:%.*]] = getelementptr i32, ptr [[FOO:%.*]], i64 [[I:%.*]]
0 commit comments