1 ; RUN: opt < %s -passes=loop-vectorize -force-vector-width=4 -S | FileCheck %s
3 ; Out of the LCSSA form we could have 'phi i32 [ loop-invariant, %for.inc.2.i ]'
4 ; but the IR Verifier requires for PHI one entry for each predecessor of
5 ; it's parent basic block. The original PR14725 solution for the issue just
6 ; added 'undef' for an predecessor BB and which is not correct. We copy the real
7 ; value for another predecessor instead of bringing 'undef'.
9 ; CHECK-LABEL: for.cond.preheader:
10 ; CHECK: %e.0.ph = phi i32 [ 0, %if.end.2.i ], [ 0, %middle.block ]
12 ; Function Attrs: nounwind uwtable
13 define void @main() #0 {
15 br label %for.cond1.preheader.i
17 for.cond1.preheader.i: ; preds = %if.end.2.i, %entry
18 %c.06.i = phi i32 [ 0, %entry ], [ %inc5.i, %if.end.2.i ]
19 %tobool.i = icmp ne i32 undef, 0
22 if.end.2.i: ; preds = %for.cond1.preheader.i
23 %inc5.i = add nsw i32 %c.06.i, 1
24 %cmp.i = icmp slt i32 %inc5.i, 16
25 br i1 %cmp.i, label %for.cond1.preheader.i, label %for.cond.preheader
27 for.cond.preheader: ; preds = %if.end.2.i
28 %e.0.ph = phi i32 [ 0, %if.end.2.i ]