[X86] Disable loop unrolling in loop vectorization pass when VF is 1.
[oota-llvm.git] / test / Transforms / LoopVectorize / unroll.ll
1 ; This test makes sure that loop will not be unrolled in vectorization if VF computed
2 ; equals to 1.
3 ; RUN: opt < %s -loop-vectorize -S | FileCheck %s
4
5 ; Make sure there are no geps being merged.
6 ; CHECK-LABEL: @foo(
7 ; CHECK: getelementptr
8 ; CHECK-NOT: getelementptr
9
10 @N = common global i32 0, align 4
11 @a = common global [1000 x i32] zeroinitializer, align 16
12
13 define void @foo() #0 {
14 entry:
15   %0 = load i32, i32* @N, align 4
16   %cmp5 = icmp sgt i32 %0, 0
17   br i1 %cmp5, label %for.body.lr.ph, label %for.end
18
19 for.body.lr.ph:                                   ; preds = %entry
20   %conv = sext i32 %0 to i64
21   br label %for.body
22
23 for.body:                                         ; preds = %for.body.lr.ph, %for.body
24   %i.06 = phi i64 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]
25   %mul = mul nuw nsw i64 %i.06, 7
26   %arrayidx = getelementptr inbounds [1000 x i32], [1000 x i32]* @a, i64 0, i64 %mul
27   store i32 3, i32* %arrayidx, align 4
28   %inc = add nuw nsw i64 %i.06, 1
29   %cmp = icmp slt i64 %inc, %conv
30   br i1 %cmp, label %for.body, label %for.end.loopexit
31
32 for.end.loopexit:                                 ; preds = %for.body
33   br label %for.end
34
35 for.end:                                          ; preds = %for.end.loopexit, %entry
36   ret void
37 }