1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
2 ; RUN: opt -passes=constraint-elimination -S %s | FileCheck %s
4 define i1 @test_overflow_sub_coefficients(i8 %x, i64 %y) {
5 ; CHECK-LABEL: define i1 @test_overflow_sub_coefficients
6 ; CHECK-SAME: (i8 [[X:%.*]], i64 [[Y:%.*]]) {
8 ; CHECK-NEXT: [[ZEXT:%.*]] = zext i8 [[X]] to i64
9 ; CHECK-NEXT: [[SHL:%.*]] = shl nuw nsw i64 [[ZEXT]], 63
10 ; CHECK-NEXT: [[ICMP:%.*]] = icmp uge i64 [[SHL]], [[Y]]
11 ; CHECK-NEXT: ret i1 [[ICMP]]
14 %zext = zext i8 %x to i64
15 %shl = shl nuw nsw i64 %zext, 63
16 %icmp = icmp uge i64 %shl, %y
20 define i1 @test_overflow_in_negate_constraint(i8 %x, i64 %y) {
21 ; CHECK-LABEL: define i1 @test_overflow_in_negate_constraint
22 ; CHECK-SAME: (i8 [[X:%.*]], i64 [[Y:%.*]]) {
24 ; CHECK-NEXT: [[ZEXT:%.*]] = zext i8 [[X]] to i64
25 ; CHECK-NEXT: [[SHL:%.*]] = shl nuw nsw i64 [[ZEXT]], 63
26 ; CHECK-NEXT: [[ICMP:%.*]] = icmp uge i64 [[Y]], [[SHL]]
27 ; CHECK-NEXT: ret i1 [[ICMP]]
30 %zext = zext i8 %x to i64
31 %shl = shl nuw nsw i64 %zext, 63
32 %icmp = icmp uge i64 %y, %shl