Cost Model: Move the 'max unroll factor' variable to the TTI and add initial Cost...
[oota-llvm.git] / test / Transforms / LoopVectorize / ARM / sanity.ll
1 ; RUN: opt < %s  -loop-vectorize -mtriple=thumbv7-apple-ios3.0.0 -S
2
3 target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32-S32"
4 target triple = "thumbv7-apple-ios3.0.0"
5
6 ; Make sure that we are not crashing on ARM.
7
8 define i32 @foo(i32* nocapture %A, i32 %n) nounwind readonly ssp {
9   %1 = icmp sgt i32 %n, 0
10   br i1 %1, label %.lr.ph, label %._crit_edge
11
12 .lr.ph:                                           ; preds = %0, %.lr.ph
13   %i.02 = phi i32 [ %5, %.lr.ph ], [ 0, %0 ]
14   %sum.01 = phi i32 [ %4, %.lr.ph ], [ 0, %0 ]
15   %2 = getelementptr inbounds i32* %A, i32 %i.02
16   %3 = load i32* %2, align 4
17   %4 = add nsw i32 %3, %sum.01
18   %5 = add nsw i32 %i.02, 1
19   %exitcond = icmp eq i32 %5, %n
20   br i1 %exitcond, label %._crit_edge, label %.lr.ph
21
22 ._crit_edge:                                      ; preds = %.lr.ph, %0
23   %sum.0.lcssa = phi i32 [ 0, %0 ], [ %4, %.lr.ph ]
24   ret i32 %sum.0.lcssa
25 }