Home | History | Annotate | Download | only in IndVarSimplify
      1 ; RUN: opt < %s -indvars -S \
      2 ; RUN:   | grep {%b.1 = phi i32 \\\[ 2, %bb \\\], \\\[ 1, %bb2 \\\]}
      3 
      4 ; This loop has multiple exits, and the value of %b1 depends on which
      5 ; exit is taken. Indvars should correctly compute the exit values.
      6 
      7 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
      8 target triple = "x86_64-pc-linux-gnu"
      9 	%struct..0anon = type <{ i8, [3 x i8] }>
     10 
     11 define i32 @main() nounwind {
     12 entry:
     13 	br label %bb2
     14 
     15 bb2:		; preds = %bb, %entry
     16 	%sdata.0 = phi i32 [ 1, %entry ], [ %ins10, %bb ]		; <i32> [#uses=2]
     17 	%b.0 = phi i32 [ 0, %entry ], [ %t0, %bb ]		; <i32> [#uses=2]
     18 	%tmp6 = trunc i32 %sdata.0 to i8		; <i8> [#uses=2]
     19 	%t2 = and i8 %tmp6, 1		; <i8> [#uses=1]
     20 	%t3 = icmp eq i8 %t2, 0		; <i1> [#uses=1]
     21 	%t4 = xor i8 %tmp6, 1		; <i8> [#uses=1]
     22 	%tmp8 = zext i8 %t4 to i32		; <i32> [#uses=1]
     23 	%mask9 = and i32 %sdata.0, -256		; <i32> [#uses=1]
     24 	%ins10 = or i32 %tmp8, %mask9		; <i32> [#uses=1]
     25 	br i1 %t3, label %bb3, label %bb
     26 
     27 bb:		; preds = %bb2
     28 	%t0 = add i32 %b.0, 1		; <i32> [#uses=3]
     29 	%t1 = icmp sgt i32 %t0, 100		; <i1> [#uses=1]
     30 	br i1 %t1, label %bb3, label %bb2
     31 
     32 bb3:		; preds = %bb, %bb2
     33 	%b.1 = phi i32 [ %t0, %bb ], [ %b.0, %bb2 ]		; <i32> [#uses=1]
     34 	%t5 = icmp eq i32 %b.1, 1		; <i1> [#uses=1]
     35 	br i1 %t5, label %bb5, label %bb4
     36 
     37 bb4:		; preds = %bb3
     38 	tail call void @abort() noreturn nounwind
     39 	unreachable
     40 
     41 bb5:		; preds = %bb3
     42 	ret i32 0
     43 }
     44 
     45 declare void @llvm.memset.i64(i8* nocapture, i8, i64, i32) nounwind
     46 
     47 declare void @abort() noreturn nounwind
     48