Home | History | Annotate | Download | only in IndVarSimplify
      1 ; RUN: opt < %s -indvars -loop-deletion -S | grep phi | count 1
      2 ; XFAIL: *
      3 
      4 ; Indvars can't evaluate this loop, because ScalarEvolution can't compute
      5 ; an exact trip count, because it doesn't know if dividing by the stride will
      6 ; have a remainder. It could be done with more aggressive VRP though.
      7 
      8 define i32 @test(i32 %x_offs) nounwind readnone {
      9 entry:
     10 	%0 = icmp sgt i32 %x_offs, 4		; <i1> [#uses=1]
     11 	br i1 %0, label %bb.nph, label %bb2
     12 
     13 bb.nph:		; preds = %entry
     14 	br label %bb
     15 
     16 bb:		; preds = %bb1, %bb.nph
     17 	%x_offs_addr.01 = phi i32 [ %1, %bb1 ], [ %x_offs, %bb.nph ]		; <i32> [#uses=1]
     18 	%1 = add i32 %x_offs_addr.01, -4		; <i32> [#uses=3]
     19 	br label %bb1
     20 
     21 bb1:		; preds = %bb
     22 	%2 = icmp sgt i32 %1, 4		; <i1> [#uses=1]
     23 	br i1 %2, label %bb, label %bb1.bb2_crit_edge
     24 
     25 bb1.bb2_crit_edge:		; preds = %bb1
     26 	br label %bb2
     27 
     28 bb2:		; preds = %bb1.bb2_crit_edge, %entry
     29 	%x_offs_addr.0.lcssa = phi i32 [ %1, %bb1.bb2_crit_edge ], [ %x_offs, %entry ]		; <i32> [#uses=1]
     30 	ret i32 %x_offs_addr.0.lcssa
     31 }
     32