1; RUN: opt < %s -loop-vectorize -force-vector-width=4 -S | FileCheck %s 2 3; Test case for PR45525. Checks that phi's with a single predecessor and a mask are supported. 4 5define void @main(i1 %cond, i32* %arr) { 6; CHECK-LABEL: @main( 7; CHECK-NEXT: bb.0: 8; CHECK-NEXT: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]] 9; CHECK: vector.ph: 10; CHECK: br label [[VECTOR_BODY:%.*]] 11; CHECK: 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> 14; 15bb.0: 16 br label %bb.1 17 18bb.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 21 22bb.2: ; preds = %bb.1 23 %single.pred = phi i32 [ %iv, %bb.1 ] 24 %mult = mul i32 %single.pred, 3 25 br label %bb.3 26 27bb.3: ; preds = %bb.2, %bb.1 28 %stored.value = phi i32 [ 7, %bb.1 ], [ %mult, %bb.2 ] 29 %arrayidx = getelementptr inbounds i32, i32* %arr, i32 %iv 30 store i32 %stored.value, i32* %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 34 35bb.4: ; preds = %bb.3 36 ret void 37} 38