3 ; RUN: opt -loop-vectorize -force-vector-interleave=2 -force-vector-width=1 -debug -disable-output %s 2>&1 | FileCheck %s
5 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
7 ; Make sure recipes with side-effects are not sunk.
8 define void @sink_with_sideeffects(i1 %c, i8* %ptr) {
9 ; CHECK-LABEL: sink_with_sideeffects
10 ; CHECK: VPlan 'Initial VPlan for VF={1},UF>=1' {
11 ; CHECK-NEXT: for.body:
12 ; CHECK-NEXT: WIDEN-INDUCTION %tmp0 = phi %tmp6, 0
13 ; CHECK-NEXT: WIDEN-INDUCTION %tmp1 = phi %tmp7, 0
14 ; CHECK-NEXT: CLONE ir<%tmp2> = getelementptr ir<%ptr>, ir<%tmp0>
15 ; CHECK-NEXT: CLONE ir<%tmp3> = load ir<%tmp2>
16 ; CHECK-NEXT: CLONE store ir<0>, ir<%tmp2>
17 ; CHECK-NEXT: CLONE ir<%tmp4> = zext ir<%tmp3>
18 ; CHECK-NEXT: CLONE ir<%tmp5> = trunc ir<%tmp4>
19 ; CHECK-NEXT: Successor(s): if.then
22 ; CHECK-NEXT: Successor(s): pred.store
24 ; CHECK: <xVFxUF> pred.store: {
25 ; CHECK-NEXT: pred.store.entry:
26 ; CHECK-NEXT: BRANCH-ON-MASK ir<%c>
27 ; CHECK-NEXT: Successor(s): pred.store.if, pred.store.continue
28 ; CHECK-NEXT: CondBit: ir<%c>
30 ; CHECK: pred.store.if:
31 ; CHECK-NEXT: CLONE store ir<%tmp5>, ir<%tmp2>
32 ; CHECK-NEXT: Successor(s): pred.store.continue
34 ; CHECK: pred.store.continue:
35 ; CHECK-NEXT: No successors
39 ; CHECK-NEXT: Successor(s): for.inc
42 ; CHECK-NEXT: No successors
49 %tmp0 = phi i64 [ %tmp6, %for.inc ], [ 0, %entry ]
50 %tmp1 = phi i64 [ %tmp7, %for.inc ], [ 0, %entry ]
51 %tmp2 = getelementptr i8, i8* %ptr, i64 %tmp0
52 %tmp3 = load i8, i8* %tmp2, align 1
54 %tmp4 = zext i8 %tmp3 to i32
55 %tmp5 = trunc i32 %tmp4 to i8
56 br i1 %c, label %if.then, label %for.inc
59 store i8 %tmp5, i8* %tmp2, align 1
63 %tmp6 = add nuw nsw i64 %tmp0, 1
64 %tmp7 = add i64 %tmp1, -1
65 %tmp8 = icmp eq i64 %tmp7, 0
66 br i1 %tmp8, label %for.end, label %for.body