| Simon Pilgrim | 7d62e4b | 2017-05-13 13:25:57 +0000 | [diff] [blame] | 1 | ; RUN: opt < %s -loop-vectorize -S | FileCheck %s | 
|  | 2 |  | 
|  | 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'. | 
|  | 8 |  | 
|  | 9 | ; CHECK-LABEL: for.cond.preheader: | 
|  | 10 | ; CHECK: %e.0.ph = phi i32 [ 0, %if.end.2.i ], [ 0, %middle.block ] | 
|  | 11 |  | 
|  | 12 | ; Function Attrs: nounwind uwtable | 
|  | 13 | define void @main() #0 { | 
|  | 14 | entry: | 
|  | 15 | br label %for.cond1.preheader.i | 
|  | 16 |  | 
|  | 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 | 
|  | 20 | br label %if.end.2.i | 
|  | 21 |  | 
|  | 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 | 
|  | 26 |  | 
|  | 27 | for.cond.preheader:                               ; preds = %if.end.2.i | 
|  | 28 | %e.0.ph = phi i32 [ 0, %if.end.2.i ] | 
|  | 29 | unreachable | 
|  | 30 | } |