1 ; RUN: opt < %s -loop-vectorize -force-vector-interleave=1 -force-vector-width=4 -enable-if-conversion -dce -instcombine -S | FileCheck %s
3 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
5 ;CHECK-LABEL: @reduction_func(
6 ;CHECK-NOT: load <4 x i32>
8 define i32 @reduction_func(i32* nocapture %A, i32 %n) nounwind uwtable readonly ssp {
10 %cmp10 = icmp sgt i32 %n, 0
11 br i1 %cmp10, label %for.body, label %for.end
13 for.body: ; preds = %entry, %for.inc
14 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
15 %sum.011 = phi i32 [ %sum.1, %for.inc ], [ 0, %entry ]
16 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
17 %0 = load i32, i32* %arrayidx, align 4
18 %cmp1 = icmp sgt i32 %0, 30
19 br i1 %cmp1, label %if.then, label %for.inc
21 if.then: ; preds = %for.body
22 %add = add i32 %sum.011, 2
23 %add4 = add i32 %add, %0
26 for.inc: ; preds = %for.body, %if.then
27 %sum.1 = phi i32 [ %add4, %if.then ], [ %sum.011, %for.body ]
28 %indvars.iv.next = add i64 %indvars.iv, 1
29 %lftr.wideiv = trunc i64 %indvars.iv.next to i32
30 %exitcond = icmp eq i32 %lftr.wideiv, %n
31 br i1 %exitcond, label %for.end, label %for.body
33 for.end: ; preds = %for.inc, %entry
34 %sum.0.lcssa = phi i32 [ 0, %entry ], [ 4, %for.inc ]