| ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 6 |
| ; RUN: opt -S -passes='print<scalar-evolution>' -disable-output < %s 2>&1 | FileCheck %s |
| |
| declare void @noundef(i8 noundef) |
| |
| define i8 @udiv_zero(i8 %x) { |
| ; CHECK-LABEL: 'udiv_zero' |
| ; CHECK-NEXT: Classifying expressions for: @udiv_zero |
| ; CHECK-NEXT: %div = udiv i8 0, %x |
| ; CHECK-NEXT: --> 0 U: [0,1) S: [0,1) |
| ; CHECK-NEXT: Determining loop execution counts for: @udiv_zero |
| ; |
| %div = udiv i8 0, %x |
| ret i8 %div |
| } |
| |
| define i8 @udiv_by_one(i8 %x) { |
| ; CHECK-LABEL: 'udiv_by_one' |
| ; CHECK-NEXT: Classifying expressions for: @udiv_by_one |
| ; CHECK-NEXT: %div = udiv i8 %x, 1 |
| ; CHECK-NEXT: --> %x U: full-set S: full-set |
| ; CHECK-NEXT: Determining loop execution counts for: @udiv_by_one |
| ; |
| %div = udiv i8 %x, 1 |
| ret i8 %div |
| } |
| |
| define i8 @udiv_mul_nuw_const_by_const1(i8 range(i8 0, 16) %x) { |
| ; CHECK-LABEL: 'udiv_mul_nuw_const_by_const1' |
| ; CHECK-NEXT: Classifying expressions for: @udiv_mul_nuw_const_by_const1 |
| ; CHECK-NEXT: %mul = mul i8 %x, 3 |
| ; CHECK-NEXT: --> (3 * %x)<nuw><nsw> U: [0,46) S: [0,46) |
| ; CHECK-NEXT: %div = udiv i8 %mul, 3 |
| ; CHECK-NEXT: --> %x U: [0,16) S: [0,16) |
| ; CHECK-NEXT: Determining loop execution counts for: @udiv_mul_nuw_const_by_const1 |
| ; |
| %mul = mul i8 %x, 3 |
| %div = udiv i8 %mul, 3 |
| ret i8 %div |
| } |
| |
| define i8 @udiv_mul_nuw_const_by_const2(i8 range(i8 0, 16) %x) { |
| ; CHECK-LABEL: 'udiv_mul_nuw_const_by_const2' |
| ; CHECK-NEXT: Classifying expressions for: @udiv_mul_nuw_const_by_const2 |
| ; CHECK-NEXT: %mul = mul i8 %x, 6 |
| ; CHECK-NEXT: --> (6 * %x)<nuw><nsw> U: [0,91) S: [0,91) |
| ; CHECK-NEXT: %div = udiv i8 %mul, 3 |
| ; CHECK-NEXT: --> (2 * %x)<nuw><nsw> U: [0,31) S: [0,31) |
| ; CHECK-NEXT: Determining loop execution counts for: @udiv_mul_nuw_const_by_const2 |
| ; |
| %mul = mul i8 %x, 6 |
| %div = udiv i8 %mul, 3 |
| ret i8 %div |
| } |
| |
| define i8 @udiv_mul_nuw_const_by_const_common_factor(i8 range(i8 0, 16) %x) { |
| ; CHECK-LABEL: 'udiv_mul_nuw_const_by_const_common_factor' |
| ; CHECK-NEXT: Classifying expressions for: @udiv_mul_nuw_const_by_const_common_factor |
| ; CHECK-NEXT: %mul = mul i8 %x, 6 |
| ; CHECK-NEXT: --> (6 * %x)<nuw><nsw> U: [0,91) S: [0,91) |
| ; CHECK-NEXT: %div = udiv i8 %mul, 4 |
| ; CHECK-NEXT: --> ((3 * %x)<nuw><nsw> /u 2) U: [0,23) S: [0,23) |
| ; CHECK-NEXT: Determining loop execution counts for: @udiv_mul_nuw_const_by_const_common_factor |
| ; |
| %mul = mul i8 %x, 6 |
| %div = udiv i8 %mul, 4 |
| ret i8 %div |
| } |
| |
| define i8 @udiv_mul_nuw_const_by_const_no_common_factor(i8 range(i8 0, 16) %x) { |
| ; CHECK-LABEL: 'udiv_mul_nuw_const_by_const_no_common_factor' |
| ; CHECK-NEXT: Classifying expressions for: @udiv_mul_nuw_const_by_const_no_common_factor |
| ; CHECK-NEXT: %mul = mul i8 %x, 7 |
| ; CHECK-NEXT: --> (7 * %x)<nuw><nsw> U: [0,106) S: [0,106) |
| ; CHECK-NEXT: %div = udiv i8 %mul, 4 |
| ; CHECK-NEXT: --> ((7 * %x)<nuw><nsw> /u 4) U: [0,27) S: [0,27) |
| ; CHECK-NEXT: Determining loop execution counts for: @udiv_mul_nuw_const_by_const_no_common_factor |
| ; |
| %mul = mul i8 %x, 7 |
| %div = udiv i8 %mul, 4 |
| ret i8 %div |
| } |
| |
| define i8 @udiv_mul_const_by_const_not_nuw(i8 %x) { |
| ; CHECK-LABEL: 'udiv_mul_const_by_const_not_nuw' |
| ; CHECK-NEXT: Classifying expressions for: @udiv_mul_const_by_const_not_nuw |
| ; CHECK-NEXT: %mul = mul i8 %x, 3 |
| ; CHECK-NEXT: --> (3 * %x) U: full-set S: full-set |
| ; CHECK-NEXT: %div = udiv i8 %mul, 3 |
| ; CHECK-NEXT: --> ((3 * %x) /u 3) U: [0,86) S: [0,86) |
| ; CHECK-NEXT: Determining loop execution counts for: @udiv_mul_const_by_const_not_nuw |
| ; |
| %mul = mul i8 %x, 3 |
| %div = udiv i8 %mul, 3 |
| ret i8 %div |
| } |
| |
| define i8 @udiv_mul_nuw_by_factor(i8 %x, i8 %y) { |
| ; CHECK-LABEL: 'udiv_mul_nuw_by_factor' |
| ; CHECK-NEXT: Classifying expressions for: @udiv_mul_nuw_by_factor |
| ; CHECK-NEXT: %mul = mul nuw i8 %x, %y |
| ; CHECK-NEXT: --> (%x * %y)<nuw> U: full-set S: full-set |
| ; CHECK-NEXT: %div = udiv i8 %mul, %y |
| ; CHECK-NEXT: --> %x U: full-set S: full-set |
| ; CHECK-NEXT: Determining loop execution counts for: @udiv_mul_nuw_by_factor |
| ; |
| %mul = mul nuw i8 %x, %y |
| call void @noundef(i8 %mul) |
| %div = udiv i8 %mul, %y |
| ret i8 %div |
| } |
| |
| define i8 @udiv_mul_by_factor_not_nuw(i8 %x, i8 %y) { |
| ; CHECK-LABEL: 'udiv_mul_by_factor_not_nuw' |
| ; CHECK-NEXT: Classifying expressions for: @udiv_mul_by_factor_not_nuw |
| ; CHECK-NEXT: %mul = mul i8 %x, %y |
| ; CHECK-NEXT: --> (%x * %y) U: full-set S: full-set |
| ; CHECK-NEXT: %div = udiv i8 %mul, %y |
| ; CHECK-NEXT: --> ((%x * %y) /u %y) U: full-set S: full-set |
| ; CHECK-NEXT: Determining loop execution counts for: @udiv_mul_by_factor_not_nuw |
| ; |
| %mul = mul i8 %x, %y |
| %div = udiv i8 %mul, %y |
| ret i8 %div |
| } |