1 ; RUN: opt < %s -loop-vectorize -force-vector-unroll=1 -force-vector-width=4 -dce 2 3 ; Check that we don't fall into an infinite loop. 4 define void @test() nounwind { 5 entry: 6 br label %for.body 7 8 for.body: 9 %0 = phi i32 [ 1, %entry ], [ 0, %for.body ] 10 br label %for.body 11 } 12 13 14 15 define void @test2() nounwind { 16 entry: 17 br label %for.body 18 19 for.body: ; preds = %for.body, %entry 20 %indvars.iv47 = phi i64 [ 0, %entry ], [ %indvars.iv.next48, %for.body ] 21 %0 = phi i32 [ 1, %entry ], [ 0, %for.body ] 22 %indvars.iv.next48 = add i64 %indvars.iv47, 1 23 br i1 undef, label %for.end, label %for.body 24 25 for.end: ; preds = %for.body 26 unreachable 27 } 28 29 ;PR14701 30 define void @start_model_rare() nounwind uwtable ssp { 31 entry: 32 br i1 undef, label %return, label %if.end 33 34 if.end: ; preds = %entry 35 br i1 undef, label %cond.false, label %cond.true 36 37 cond.true: ; preds = %if.end 38 unreachable 39 40 cond.false: ; preds = %if.end 41 br i1 undef, label %cond.false28, label %cond.true20 42 43 cond.true20: ; preds = %cond.false 44 unreachable 45 46 cond.false28: ; preds = %cond.false 47 br label %for.body40 48 49 for.body40: ; preds = %for.inc50, %cond.false28 50 %indvars.iv123 = phi i64 [ 3, %cond.false28 ], [ %indvars.iv.next124, %for.inc50 ] 51 %step.0121 = phi i32 [ 1, %cond.false28 ], [ %step.1, %for.inc50 ] 52 br i1 undef, label %if.then46, label %for.inc50 53 54 if.then46: ; preds = %for.body40 55 %inc47 = add nsw i32 %step.0121, 1 56 br label %for.inc50 57 58 for.inc50: ; preds = %if.then46, %for.body40 59 %k.1 = phi i32 [ undef, %for.body40 ], [ %inc47, %if.then46 ] 60 %step.1 = phi i32 [ %step.0121, %for.body40 ], [ %inc47, %if.then46 ] 61 %indvars.iv.next124 = add i64 %indvars.iv123, 1 62 %lftr.wideiv = trunc i64 %indvars.iv.next124 to i32 63 %exitcond = icmp eq i32 %lftr.wideiv, 256 64 br i1 %exitcond, label %for.end52, label %for.body40 65 66 for.end52: ; preds = %for.inc50 67 unreachable 68 69 return: ; preds = %entry 70 ret void 71 } 72