1 ; RUN: opt < %s -loop-vectorize -force-vector-interleave=1 -force-vector-width=4 -enable-if-conversion -dce -instcombine -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 6 ;CHECK-LABEL: @foo( 7 ;CHECK: icmp eq <4 x i32> 8 ;CHECK: select <4 x i1> 9 ;CHECK: ret i32 10 define i32 @foo(i32 %x, i32 %t, i32* nocapture %A) nounwind uwtable ssp { 11 entry: 12 %cmp10 = icmp sgt i32 %x, 0 13 br i1 %cmp10, label %for.body, label %for.end 14 15 for.body: ; preds = %entry, %if.end 16 %indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 0, %entry ] 17 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %indvars.iv 18 %0 = load i32, i32* %arrayidx, align 4 19 %tobool = icmp eq i32 %0, 0 20 br i1 %tobool, label %if.end, label %if.then 21 22 if.then: ; preds = %for.body 23 %1 = add nsw i64 %indvars.iv, 45 24 %2 = trunc i64 %indvars.iv to i32 25 %mul = mul nsw i32 %2, %t 26 %3 = trunc i64 %1 to i32 27 %add1 = add nsw i32 %3, %mul 28 br label %if.end 29 30 if.end: ; preds = %for.body, %if.then 31 %z.0 = phi i32 [ %add1, %if.then ], [ 9, %for.body ] 32 store i32 %z.0, i32* %arrayidx, align 4 33 %indvars.iv.next = add nsw i64 %indvars.iv, 1 34 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 35 %exitcond = icmp eq i32 %lftr.wideiv, %x 36 br i1 %exitcond, label %for.end, label %for.body 37 38 for.end: ; preds = %if.end, %entry 39 ret i32 undef 40 } 41