1 ; RUN: opt < %s -passes=loop-vectorize -force-vector-width=4 -S | FileCheck %s
3 ; Test case for PR45525. Checks that phi's with a single predecessor and a mask are supported.
5 define void @main(i1 %cond, ptr %arr) {
8 ; CHECK-NEXT: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]]
10 ; CHECK: br label [[VECTOR_BODY:%.*]]
12 ; CHECK: [[VEC_IND:%.*]] = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, [[VECTOR_PH]] ], [ [[VEC_IND_NEXT:%.*]], [[VECTOR_BODY]] ]
13 ; CHECK: [[TMP5:%.*]] = mul <4 x i32> [[VEC_IND]], <i32 3, i32 3, i32 3, i32 3>
18 bb.1: ; preds = %bb.3, %bb.0
19 %iv = phi i32 [ 0, %bb.0 ], [ %iv.next, %bb.3 ]
20 br i1 %cond, label %bb.3, label %bb.2
23 %single.pred = phi i32 [ %iv, %bb.1 ]
24 %mult = mul i32 %single.pred, 3
27 bb.3: ; preds = %bb.2, %bb.1
28 %stored.value = phi i32 [ 7, %bb.1 ], [ %mult, %bb.2 ]
29 %arrayidx = getelementptr inbounds i32, ptr %arr, i32 %iv
30 store i32 %stored.value, ptr %arrayidx
31 %iv.next = add i32 %iv, 1
32 %continue = icmp ult i32 %iv.next, 32
33 br i1 %continue, label %bb.1, label %bb.4