1*cee313d2SEric Christopher; RUN: opt < %s -loop-vectorize -force-vector-interleave=1 -force-vector-width=4 -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: @read_only_func( 6*cee313d2SEric Christopher;CHECK: load <4 x i32> 7*cee313d2SEric Christopher;CHECK: ret i32 8*cee313d2SEric Christopherdefine i32 @read_only_func(i32* nocapture %A, i32* nocapture %B, i32 %n) nounwind uwtable readonly ssp { 9*cee313d2SEric Christopher %1 = icmp sgt i32 %n, 0 10*cee313d2SEric Christopher br i1 %1, label %.lr.ph, label %._crit_edge 11*cee313d2SEric Christopher 12*cee313d2SEric Christopher.lr.ph: ; preds = %0, %.lr.ph 13*cee313d2SEric Christopher %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ] 14*cee313d2SEric Christopher %sum.02 = phi i32 [ %9, %.lr.ph ], [ 0, %0 ] 15*cee313d2SEric Christopher %2 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv 16*cee313d2SEric Christopher %3 = load i32, i32* %2, align 4 17*cee313d2SEric Christopher %4 = add nsw i64 %indvars.iv, 13 18*cee313d2SEric Christopher %5 = getelementptr inbounds i32, i32* %B, i64 %4 19*cee313d2SEric Christopher %6 = load i32, i32* %5, align 4 20*cee313d2SEric Christopher %7 = shl i32 %6, 1 21*cee313d2SEric Christopher %8 = add i32 %3, %sum.02 22*cee313d2SEric Christopher %9 = add i32 %8, %7 23*cee313d2SEric Christopher %indvars.iv.next = add i64 %indvars.iv, 1 24*cee313d2SEric Christopher %lftr.wideiv = trunc i64 %indvars.iv.next to i32 25*cee313d2SEric Christopher %exitcond = icmp eq i32 %lftr.wideiv, %n 26*cee313d2SEric Christopher br i1 %exitcond, label %._crit_edge, label %.lr.ph 27*cee313d2SEric Christopher 28*cee313d2SEric Christopher._crit_edge: ; preds = %.lr.ph, %0 29*cee313d2SEric Christopher %sum.0.lcssa = phi i32 [ 0, %0 ], [ %9, %.lr.ph ] 30*cee313d2SEric Christopher ret i32 %sum.0.lcssa 31*cee313d2SEric Christopher} 32