Home | History | Annotate | Download | only in IndVarSimplify
      1 ; RUN: opt < %s -indvars -S > %t
      2 ; RUN: not grep sext %t
      3 ; RUN: grep phi %t | count 1
      4 
      5 ; Provide legal integer types.
      6 target datalayout = "n8:16:32:64"
      7 
      8 
      9 define void @foo(i64* nocapture %x, i32 %n) nounwind {
     10 entry:
     11 	%tmp102 = icmp sgt i32 %n, 0		; <i1> [#uses=1]
     12 	br i1 %tmp102, label %bb.nph, label %return
     13 
     14 bb.nph:		; preds = %entry
     15 	br label %bb
     16 
     17 bb:		; preds = %bb7, %bb.nph
     18 	%i.01 = phi i32 [ %tmp6, %bb7 ], [ 0, %bb.nph ]		; <i32> [#uses=3]
     19 	%tmp1 = sext i32 %i.01 to i64		; <i64> [#uses=1]
     20 	%tmp4 = getelementptr i64, i64* %x, i32 %i.01		; <i64*> [#uses=1]
     21 	store i64 %tmp1, i64* %tmp4, align 8
     22 	%tmp6 = add i32 %i.01, 1		; <i32> [#uses=2]
     23 	br label %bb7
     24 
     25 bb7:		; preds = %bb
     26 	%tmp10 = icmp slt i32 %tmp6, %n		; <i1> [#uses=1]
     27 	br i1 %tmp10, label %bb, label %bb7.return_crit_edge
     28 
     29 bb7.return_crit_edge:		; preds = %bb7
     30 	br label %return
     31 
     32 return:		; preds = %bb7.return_crit_edge, %entry
     33 	ret void
     34 }
     35