Reapply 184685 after the SetVector iteration order fix.
[oota-llvm.git] / test / Transforms / LoopVectorize / no_outside_user.ll
1 ; RUN: opt -S -loop-vectorize -force-vector-unroll=1 -force-vector-width=2 < %s | FileCheck %s
2
3 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S128"
4
5 @f = common global i32 0, align 4
6 @.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
7 @c = common global i32 0, align 4
8 @a = common global i32 0, align 4
9 @b = common global i32 0, align 4
10 @e = common global i32 0, align 4
11
12 ; We used to vectorize this loop. But it has a value that is used outside of the
13 ; and is not a recognized reduction variable "tmp17".
14
15 ; CHECK-NOT: <2 x i32>
16
17 define i32 @main()  {
18 bb:
19   %b.promoted = load i32* @b, align 4
20   br label %.lr.ph.i
21
22 .lr.ph.i:
23   %tmp8 = phi i32 [ %tmp18, %bb16 ], [ %b.promoted, %bb ]
24   %tmp2 = icmp sgt i32 %tmp8, 10
25   br i1 %tmp2, label %bb16, label %bb10
26
27 bb10:
28   br label %bb16
29
30 bb16:
31   %tmp17 = phi i32 [ 0, %bb10 ], [ 1, %.lr.ph.i ]
32   %tmp18 = add nsw i32 %tmp8, 1
33   %tmp19 = icmp slt i32 %tmp18, 4
34   br i1 %tmp19, label %.lr.ph.i, label %f1.exit.loopexit
35
36 f1.exit.loopexit:
37   %.lcssa = phi i32 [ %tmp17, %bb16 ]
38   ret i32 %.lcssa
39 }
40
41