diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/Analysis/ScalarEvolution/trip-count9.ll | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/test/Analysis/ScalarEvolution/trip-count9.ll b/test/Analysis/ScalarEvolution/trip-count9.ll index 9180f2b..85d4050 100644 --- a/test/Analysis/ScalarEvolution/trip-count9.ll +++ b/test/Analysis/ScalarEvolution/trip-count9.ll @@ -25,8 +25,8 @@ exit: } ; CHECK: Determining loop execution counts for: @step2 -; CHECK: Loop %loop: Unpredictable backedge-taken count. -; CHECK: Loop %loop: Unpredictable max backedge-taken count. +; CHECK: Loop %loop: Unpredictable backedge-taken count. +; CHECK: Loop %loop: Unpredictable max backedge-taken count. define void @step2(i4 %n) { entry: %s = icmp sgt i4 %n, 0 @@ -57,8 +57,8 @@ exit: } ; CHECK: Determining loop execution counts for: @start1_step2 -; CHECK: Loop %loop: Unpredictable backedge-taken count. -; CHECK: Loop %loop: Unpredictable max backedge-taken count. +; CHECK: Loop %loop: Unpredictable backedge-taken count. +; CHECK: Loop %loop: Unpredictable max backedge-taken count. define void @start1_step2(i4 %n) { entry: %s = icmp sgt i4 %n, 0 @@ -89,8 +89,8 @@ exit: } ; CHECK: Determining loop execution counts for: @startx_step2 -; CHECK: Loop %loop: Unpredictable backedge-taken count. -; CHECK: Loop %loop: Unpredictable max backedge-taken count. +; CHECK: Loop %loop: Unpredictable backedge-taken count. +; CHECK: Loop %loop: Unpredictable max backedge-taken count. define void @startx_step2(i4 %n, i4 %x) { entry: %s = icmp sgt i4 %n, 0 @@ -120,12 +120,18 @@ exit: ret void } -; Be careful with this one. If %n is INT4_MAX, %i.next will wrap. The nsw bit -; says that the result is undefined, but ScalarEvolution must respect that -; subsequent passes may result the undefined behavior in predictable ways. +; If %n is INT4_MAX, %i.next will wrap. The nsw bit says that the +; result is undefined. Therefore, after the loop's second iteration, +; we are free to assume that the loop exits. This is valid because: +; (a) %i.next is a poison value after the second iteration, which can +; also be considered an undef value. +; (b) the return instruction enacts a side effect that is control +; dependent on the poison value. +; +; CHECK-LABEL: nsw_step2 ; CHECK: Determining loop execution counts for: @nsw_step2 -; CHECK: Loop %loop: Unpredictable backedge-taken count. -; CHECK: Loop %loop: Unpredictable max backedge-taken count. +; CHECK: Loop %loop: backedge-taken count is ((-1 + %n) /u 2) +; CHECK: Loop %loop: max backedge-taken count is 2 define void @nsw_step2(i4 %n) { entry: %s = icmp sgt i4 %n, 0 @@ -139,6 +145,7 @@ exit: ret void } +; CHECK-LABEL: nsw_start1 ; CHECK: Determining loop execution counts for: @nsw_start1 ; CHECK: Loop %loop: backedge-taken count is (-2 + (2 smax %n)) ; CHECK: Loop %loop: max backedge-taken count is 5 @@ -156,8 +163,8 @@ exit: } ; CHECK: Determining loop execution counts for: @nsw_start1_step2 -; CHECK: Loop %loop: Unpredictable backedge-taken count. -; CHECK: Loop %loop: Unpredictable max backedge-taken count. +; CHECK: Loop %loop: backedge-taken count is ((-2 + (3 smax %n)) /u 2) +; CHECK: Loop %loop: max backedge-taken count is 2 define void @nsw_start1_step2(i4 %n) { entry: %s = icmp sgt i4 %n, 0 @@ -188,8 +195,8 @@ exit: } ; CHECK: Determining loop execution counts for: @nsw_startx_step2 -; CHECK: Loop %loop: Unpredictable backedge-taken count. -; CHECK: Loop %loop: Unpredictable max backedge-taken count. +; CHECK: Loop %loop: backedge-taken count is ((-1 + (-1 * %x) + ((2 + %x) smax %n)) /u 2) +; CHECK: Loop %loop: max backedge-taken count is 7 define void @nsw_startx_step2(i4 %n, i4 %x) { entry: %s = icmp sgt i4 %n, 0 @@ -221,7 +228,7 @@ exit: } ; CHECK: Determining loop execution counts for: @even_step2 -; CHECK: Loop %loop: Unpredictable backedge-taken count. +; CHECK: Loop %loop: Unpredictable backedge-taken count. ; CHECK: Loop %loop: max backedge-taken count is 2 define void @even_step2(i4 %n) { entry: @@ -255,7 +262,7 @@ exit: } ; CHECK: Determining loop execution counts for: @even_start1_step2 -; CHECK: Loop %loop: Unpredictable backedge-taken count. +; CHECK: Loop %loop: Unpredictable backedge-taken count. ; CHECK: Loop %loop: max backedge-taken count is 2 define void @even_start1_step2(i4 %n) { entry: @@ -289,7 +296,7 @@ exit: } ; CHECK: Determining loop execution counts for: @even_startx_step2 -; CHECK: Loop %loop: Unpredictable backedge-taken count. +; CHECK: Loop %loop: Unpredictable backedge-taken count. ; CHECK: Loop %loop: max backedge-taken count is 7 define void @even_startx_step2(i4 %n, i4 %x) { entry: |