1; RUN: opt -S -basicaa -loop-vectorize < %s | FileCheck %s
2target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
3target triple = "x86_64-apple-macosx10.11.0"
4
5define i32 @accum(i32* nocapture readonly %x, i32 %N) #0 {
6entry:
7; CHECK-LABEL: @accum
8; CHECK-NOT: x i32>
9
10  %cmp1 = icmp sgt i32 %N, 0
11  br i1 %cmp1, label %for.inc.preheader, label %for.end
12
13for.inc.preheader:
14  br label %for.inc
15
16for.inc:
17  %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %for.inc.preheader ]
18  %sum.02 = phi i32 [ %add, %for.inc ], [ 0, %for.inc.preheader ]
19  %arrayidx = getelementptr inbounds i32, i32* %x, i64 %indvars.iv
20  %0 = load i32, i32* %arrayidx, align 4
21  %add = add nsw i32 %0, %sum.02
22  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
23  %lftr.wideiv = trunc i64 %indvars.iv.next to i32
24  %exitcond = icmp eq i32 %lftr.wideiv, %N
25  br i1 %exitcond, label %for.end.loopexit, label %for.inc
26
27for.end.loopexit:
28  %add.lcssa = phi i32 [ %add, %for.inc ]
29  br label %for.end
30
31for.end:
32  %sum.0.lcssa = phi i32 [ 0, %entry ], [ %add.lcssa, %for.end.loopexit ]
33  ret i32 %sum.0.lcssa
34
35; CHECK: ret i32
36}
37
38attributes #0 = { "target-cpu"="core2" "target-features"="+sse,-avx,-avx2,-sse2" }
39
40