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