1*cee313d2SEric Christopher; RUN: opt -indvars -loop-vectorize -force-vector-width=2 -force-vector-interleave=1 -S < %s | FileCheck %s
2*cee313d2SEric Christopher
3*cee313d2SEric Christophertarget datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
4*cee313d2SEric Christopher
5*cee313d2SEric Christopher; We must not vectorize this loop. %add55 is not reduction. Its value is used
6*cee313d2SEric Christopher; multiple times.
7*cee313d2SEric Christopher
8*cee313d2SEric Christopher; PR18526
9*cee313d2SEric Christopher
10*cee313d2SEric Christopher; CHECK: multiple_use_of_value
11*cee313d2SEric Christopher; CHECK-NOT: <2 x i32>
12*cee313d2SEric Christopher
13*cee313d2SEric Christopherdefine void @multiple_use_of_value() {
14*cee313d2SEric Christopherentry:
15*cee313d2SEric Christopher  %n = alloca i32, align 4
16*cee313d2SEric Christopher  %k7 = alloca i32, align 4
17*cee313d2SEric Christopher  %nf = alloca i32, align 4
18*cee313d2SEric Christopher  %0 = load i32, i32* %k7, align 4
19*cee313d2SEric Christopher  %.neg1 = sub i32 0, %0
20*cee313d2SEric Christopher  %n.promoted = load i32, i32* %n, align 4
21*cee313d2SEric Christopher  %nf.promoted = load i32, i32* %nf, align 4
22*cee313d2SEric Christopher  br label %for.body
23*cee313d2SEric Christopher
24*cee313d2SEric Christopherfor.body:
25*cee313d2SEric Christopher  %inc107 = phi i32 [ undef, %entry ], [ %inc10, %for.body ]
26*cee313d2SEric Christopher  %inc6 = phi i32 [ %nf.promoted, %entry ], [ undef, %for.body ]
27*cee313d2SEric Christopher  %add55 = phi i32 [ %n.promoted, %entry ], [ %add5, %for.body ]
28*cee313d2SEric Christopher  %.neg2 = sub i32 0, %inc6
29*cee313d2SEric Christopher  %add.neg = add i32 0, %add55
30*cee313d2SEric Christopher  %add4.neg = add i32 %add.neg, %.neg1
31*cee313d2SEric Christopher  %sub = add i32 %add4.neg, %.neg2
32*cee313d2SEric Christopher  %add5 = add i32 %sub, %add55
33*cee313d2SEric Christopher  %inc10 = add i32 %inc107, 1
34*cee313d2SEric Christopher  %cmp = icmp ult i32 %inc10, 61
35*cee313d2SEric Christopher  br i1 %cmp, label %for.body, label %for.end
36*cee313d2SEric Christopher
37*cee313d2SEric Christopherfor.end:
38*cee313d2SEric Christopher  %add5.lcssa = phi i32 [ %add5, %for.body ]
39*cee313d2SEric Christopher  store i32 %add5.lcssa, i32* %n, align 4
40*cee313d2SEric Christopher  ret void
41*cee313d2SEric Christopher}
42