Home | History | Annotate | Download | only in ScalarEvolution
      1 ; RUN: opt < %s -scalar-evolution -analyze | FileCheck %s
      2 
      3 define void @test1(i32 %n) {
      4 entry:
      5   %s = mul i32 %n, 96
      6   br label %loop
      7 loop:
      8   %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
      9   %i.next = add i32 %i, 32
     10   %t = icmp ne i32 %i.next, %s
     11   br i1 %t, label %loop, label %exit
     12 exit:
     13   ret void
     14 
     15 ; CHECK-LABEL: @test1
     16 ; CHECK: Loop %loop: backedge-taken count is ((-32 + (96 * %n)) /u 32)
     17 ; CHECK: Loop %loop: max backedge-taken count is ((-32 + (96 * %n)) /u 32)
     18 }
     19 
     20 ; PR19183
     21 define i32 @test2(i32 %n) {
     22 entry:
     23   %s = and i32 %n, -32
     24   br label %loop
     25 loop:
     26   %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
     27   %i.next = add i32 %i, 32
     28   %t = icmp ne i32 %i.next, %s
     29   br i1 %t, label %loop, label %exit
     30 exit:
     31   ret i32 %i
     32 
     33 ; CHECK-LABEL: @test2
     34 ; CHECK: Loop %loop: backedge-taken count is ((-32 + (32 * (%n /u 32))) /u 32)
     35 ; CHECK: Loop %loop: max backedge-taken count is ((-32 + (32 * (%n /u 32))) /u 32)
     36 }
     37 
     38 define void @test3(i32 %n) {
     39 entry:
     40   %s = mul i32 %n, 96
     41   br label %loop
     42 loop:
     43   %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
     44   %i.next = add i32 %i, 96
     45   %t = icmp ne i32 %i.next, %s
     46   br i1 %t, label %loop, label %exit
     47 exit:
     48   ret void
     49 
     50 ; CHECK-LABEL: @test3
     51 ; CHECK: Loop %loop: Unpredictable backedge-taken count.
     52 ; CHECK: Loop %loop: Unpredictable max backedge-taken count.
     53 }
     54