1*cee313d2SEric Christopher; RUN: opt < %s -loop-vectorize -force-vector-interleave=1 -force-vector-width=4 -enable-if-conversion -dce -instcombine -S | FileCheck %s 2*cee313d2SEric Christopher 3*cee313d2SEric Christophertarget 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" 4*cee313d2SEric Christopher 5*cee313d2SEric Christopher;CHECK-LABEL: @reduction_func( 6*cee313d2SEric Christopher;CHECK-NOT: load <4 x i32> 7*cee313d2SEric Christopher;CHECK: ret i32 8*cee313d2SEric Christopherdefine i32 @reduction_func(i32* nocapture %A, i32 %n) nounwind uwtable readonly ssp { 9*cee313d2SEric Christopherentry: 10*cee313d2SEric Christopher %cmp10 = icmp sgt i32 %n, 0 11*cee313d2SEric Christopher br i1 %cmp10, label %for.body, label %for.end 12*cee313d2SEric Christopher 13*cee313d2SEric Christopherfor.body: ; preds = %entry, %for.inc 14*cee313d2SEric Christopher %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ] 15*cee313d2SEric Christopher %sum.011 = phi i32 [ %sum.1, %for.inc ], [ 0, %entry ] 16*cee313d2SEric Christopher %arrayidx = getelementptr inbounds i32, i32* %A, i64 %indvars.iv 17*cee313d2SEric Christopher %0 = load i32, i32* %arrayidx, align 4 18*cee313d2SEric Christopher %cmp1 = icmp sgt i32 %0, 30 19*cee313d2SEric Christopher br i1 %cmp1, label %if.then, label %for.inc 20*cee313d2SEric Christopher 21*cee313d2SEric Christopherif.then: ; preds = %for.body 22*cee313d2SEric Christopher %add = add i32 %sum.011, 2 23*cee313d2SEric Christopher %add4 = add i32 %add, %0 24*cee313d2SEric Christopher br label %for.inc 25*cee313d2SEric Christopher 26*cee313d2SEric Christopherfor.inc: ; preds = %for.body, %if.then 27*cee313d2SEric Christopher %sum.1 = phi i32 [ %add4, %if.then ], [ %sum.011, %for.body ] 28*cee313d2SEric Christopher %indvars.iv.next = add i64 %indvars.iv, 1 29*cee313d2SEric Christopher %lftr.wideiv = trunc i64 %indvars.iv.next to i32 30*cee313d2SEric Christopher %exitcond = icmp eq i32 %lftr.wideiv, %n 31*cee313d2SEric Christopher br i1 %exitcond, label %for.end, label %for.body 32*cee313d2SEric Christopher 33*cee313d2SEric Christopherfor.end: ; preds = %for.inc, %entry 34*cee313d2SEric Christopher %sum.0.lcssa = phi i32 [ 0, %entry ], [ 4, %for.inc ] 35*cee313d2SEric Christopher ret i32 %sum.0.lcssa 36*cee313d2SEric Christopher} 37*cee313d2SEric Christopher 38