72 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py2; RUN: opt < %s --data-layout="e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" -S -disable-output "-passes=print<scalar-evolution>" 2>&1 | FileCheck %s3; RUN: opt < %s --data-layout="e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:32-n8:16:32-S128" -S -disable-output "-passes=print<scalar-evolution>" 2>&1 | FileCheck %s4 5; In general, we can't deal with ashr.6define i32 @t0(i32 %x, i32 %y) {7; CHECK-LABEL: 't0'8; CHECK-NEXT: Classifying expressions for: @t09; CHECK-NEXT: %i0 = ashr i32 %x, %y10; CHECK-NEXT: --> %i0 U: full-set S: full-set11; CHECK-NEXT: Determining loop execution counts for: @t012;13 %i0 = ashr i32 %x, %y14 ret i32 %i015}16; Not even if we know it's exact17define i32 @t1(i32 %x, i32 %y) {18; CHECK-LABEL: 't1'19; CHECK-NEXT: Classifying expressions for: @t120; CHECK-NEXT: %i0 = ashr exact i32 %x, %y21; CHECK-NEXT: --> %i0 U: full-set S: full-set22; CHECK-NEXT: Determining loop execution counts for: @t123;24 %i0 = ashr exact i32 %x, %y25 ret i32 %i026}27; Not even if the shift amount is a constant.28define i32 @t2(i32 %x, i32 %y) {29; CHECK-LABEL: 't2'30; CHECK-NEXT: Classifying expressions for: @t231; CHECK-NEXT: %i0 = ashr i32 %x, 432; CHECK-NEXT: --> %i0 U: [-134217728,134217728) S: [-134217728,134217728)33; CHECK-NEXT: Determining loop execution counts for: @t234;35 %i0 = ashr i32 %x, 436 ret i32 %i037}38; However, if it's a constant AND the shift is exact, we can model it!39define i32 @t3(i32 %x, i32 %y) {40; CHECK-LABEL: 't3'41; CHECK-NEXT: Classifying expressions for: @t342; CHECK-NEXT: %i0 = ashr exact i32 %x, 443; CHECK-NEXT: --> %i0 U: [-134217728,134217728) S: [-134217728,134217728)44; CHECK-NEXT: Determining loop execution counts for: @t345;46 %i0 = ashr exact i32 %x, 447 ret i32 %i048}49; As long as the shift amount is in-bounds50define i32 @t4(i32 %x, i32 %y) {51; CHECK-LABEL: 't4'52; CHECK-NEXT: Classifying expressions for: @t453; CHECK-NEXT: %i0 = ashr exact i32 %x, 3254; CHECK-NEXT: --> %i0 U: [0,1) S: [0,1)55; CHECK-NEXT: Determining loop execution counts for: @t456;57 %i0 = ashr exact i32 %x, 3258 ret i32 %i059}60 61; One more test, just to see that we model constant correctly62define i32 @t5(i32 %x, i32 %y) {63; CHECK-LABEL: 't5'64; CHECK-NEXT: Classifying expressions for: @t565; CHECK-NEXT: %i0 = ashr exact i32 %x, 566; CHECK-NEXT: --> %i0 U: [-67108864,67108864) S: [-67108864,67108864)67; CHECK-NEXT: Determining loop execution counts for: @t568;69 %i0 = ashr exact i32 %x, 570 ret i32 %i071}72