Home | History | Annotate | Download | only in ScalarEvolution
      1 ; RUN: opt < %s -scalar-evolution -analyze | FileCheck %s
      2 ; PR1597
      3 
      4 ; CHECK: Loop %bb: backedge-taken count is (-1 + (-1 * %x) + %y)
      5 
      6 define i32 @f(i32 %x, i32 %y) {
      7 entry:
      8         %tmp63 = icmp ult i32 %x, %y            ; <i1> [#uses=1]
      9         br i1 %tmp63, label %bb.preheader, label %bb8
     10 
     11 bb.preheader:           ; preds = %entry
     12         br label %bb
     13 
     14 bb:             ; preds = %bb3, %bb.preheader
     15         %x_addr.0 = phi i32 [ %tmp2, %bb3 ], [ %x, %bb.preheader ]              ; <i32> [#uses=1]
     16         %tmp2 = add i32 %x_addr.0, 1            ; <i32> [#uses=3]
     17         br label %bb3
     18 
     19 bb3:            ; preds = %bb
     20         %tmp6 = icmp ult i32 %tmp2, %y          ; <i1> [#uses=1]
     21         br i1 %tmp6, label %bb, label %bb8.loopexit
     22 
     23 bb8.loopexit:           ; preds = %bb3
     24         br label %bb8
     25 
     26 bb8:            ; preds = %bb8.loopexit, %entry
     27         %x_addr.1 = phi i32 [ %x, %entry ], [ %tmp2, %bb8.loopexit ]            ; <i32> [#uses=1]
     28         br label %return
     29 
     30 return:         ; preds = %bb8
     31         ret i32 %x_addr.1
     32 }
     33