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