1 ; RUN: opt < %s -loop-vectorize -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx -force-vector-width=4 -force-vector-unroll=0 -dce -S | FileCheck %s 2 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" 4 target triple = "x86_64-apple-macosx10.8.0" 5 ;CHECK-LABEL: @foo( 6 ;CHECK: load <4 x i32> 7 ;CHECK-NOT: load <4 x i32> 8 ;CHECK: store <4 x i32> 9 ;CHECK-NOT: store <4 x i32> 10 ;CHECK: ret 11 define i32 @foo(i32* nocapture %A) nounwind uwtable ssp { 12 br label %1 13 14 ; <label>:1 ; preds = %1, %0 15 %indvars.iv = phi i64 [ 0, %0 ], [ %indvars.iv.next, %1 ] 16 %2 = getelementptr inbounds i32* %A, i64 %indvars.iv 17 %3 = load i32* %2, align 4 18 %4 = add nsw i32 %3, 6 19 store i32 %4, i32* %2, align 4 20 %indvars.iv.next = add i64 %indvars.iv, 1 21 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 22 %exitcond = icmp eq i32 %lftr.wideiv, 100 23 br i1 %exitcond, label %5, label %1 24 25 ; <label>:5 ; preds = %1 26 ret i32 undef 27 } 28 29 ;CHECK-LABEL: @bar( 30 ;CHECK: store <4 x i32> 31 ;CHECK: store <4 x i32> 32 ;CHECK: ret 33 define i32 @bar(i32* nocapture %A, i32 %n) nounwind uwtable ssp { 34 %1 = icmp sgt i32 %n, 0 35 br i1 %1, label %.lr.ph, label %._crit_edge 36 37 .lr.ph: ; preds = %0, %.lr.ph 38 %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ] 39 %2 = getelementptr inbounds i32* %A, i64 %indvars.iv 40 %3 = load i32* %2, align 4 41 %4 = add nsw i32 %3, 6 42 store i32 %4, i32* %2, align 4 43 %indvars.iv.next = add i64 %indvars.iv, 1 44 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 45 %exitcond = icmp eq i32 %lftr.wideiv, %n 46 br i1 %exitcond, label %._crit_edge, label %.lr.ph 47 48 ._crit_edge: ; preds = %.lr.ph, %0 49 ret i32 undef 50 } 51