98 lines · plain
1; RUN: opt < %s -passes=loop-vectorize -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7 -debug-only=loop-vectorize -S 2>&1 | FileCheck %s2; REQUIRES: asserts3target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"4target triple = "x86_64-unknown-linux-gnu"5 6; CHECK-LABEL: test7; CHECK-DAG: LV: Found uniform instruction: %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]8; CHECK-DAG: LV: Found uniform instruction: %indvars.iv.next = add nuw nsw i64 %indvars.iv, 19; CHECK-DAG: LV: Found uniform instruction: %exitcond = icmp eq i64 %indvars.iv, 159910 11define void @test(ptr noalias nocapture %a, ptr noalias nocapture readonly %b) #0 {12entry:13 br label %for.body14 15for.body: ; preds = %for.body, %entry16 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]17 %arrayidx = getelementptr inbounds float, ptr %b, i64 %indvars.iv18 %tmp0 = load float, ptr %arrayidx, align 419 %add = fadd float %tmp0, 1.000000e+0020 %arrayidx5 = getelementptr inbounds float, ptr %a, i64 %indvars.iv21 store float %add, ptr %arrayidx5, align 422 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 123 %exitcond = icmp eq i64 %indvars.iv, 159924 br i1 %exitcond, label %for.end, label %for.body25 26for.end: ; preds = %for.body27 ret void28}29 30; CHECK-LABEL: foo31; CHECK-DAG: LV: Found uniform instruction: %cond = icmp eq i64 %i.next, %n32; CHECK-DAG: LV: Found uniform instruction: %tmp1 = getelementptr inbounds i32, ptr %a, i32 %tmp033; CHECK-NOT: LV: Found uniform instruction: %i = phi i64 [ %i.next, %for.body ], [ 0, %entry ]34 35define void @foo(ptr %a, i64 %n) {36entry:37 br label %for.body38 39for.body:40 %i = phi i64 [ %i.next, %for.body ], [ 0, %entry ]41 %tmp0 = trunc i64 %i to i3242 %tmp1 = getelementptr inbounds i32, ptr %a, i32 %tmp043 store i32 %tmp0, ptr %tmp1, align 444 %i.next = add nuw nsw i64 %i, 145 %cond = icmp eq i64 %i.next, %n46 br i1 %cond, label %for.end, label %for.body47 48for.end:49 ret void50}51 52; CHECK-LABEL: goo53; Check %indvars.iv and %indvars.iv.next are uniform instructions even if they are used outside of loop.54; CHECK-DAG: LV: Found uniform instruction: %exitcond = icmp eq i64 %indvars.iv, 159955 56define i64 @goo(ptr noalias nocapture %a, ptr noalias nocapture readonly %b) #0 {57entry:58 br label %for.body59 60for.body: ; preds = %for.body, %entry61 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]62 %arrayidx = getelementptr inbounds float, ptr %b, i64 %indvars.iv63 %tmp0 = load float, ptr %arrayidx, align 464 %add = fadd float %tmp0, 1.000000e+0065 %arrayidx5 = getelementptr inbounds float, ptr %a, i64 %indvars.iv66 store float %add, ptr %arrayidx5, align 467 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 168 %exitcond = icmp eq i64 %indvars.iv, 159969 br i1 %exitcond, label %for.end, label %for.body70 71for.end: ; preds = %for.body72 %retval = add i64 %indvars.iv, %indvars.iv.next73 ret i64 %retval74}75 76; CHECK-LABEL: PR3878677; Check that first order recurrence phis (%phi32 and %phi64) are not uniform.78; CHECK-NOT: LV: Found uniform instruction: %phi79define void @PR38786(ptr %y, ptr %x, i64 %n) {80entry:81 br label %for.body82 83for.body:84 %phi32 = phi i32 [ 0, %entry ], [ %i32next, %for.body ]85 %phi64 = phi i64 [ 0, %entry ], [ %i64next, %for.body ]86 %i32next = add i32 %phi32, 187 %i64next = zext i32 %i32next to i6488 %xip = getelementptr inbounds double, ptr %x, i64 %i64next89 %yip = getelementptr inbounds double, ptr %y, i64 %phi6490 %xi = load double, ptr %xip, align 891 store double %xi, ptr %yip, align 892 %cmp = icmp slt i64 %i64next, %n93 br i1 %cmp, label %for.body, label %for.end94 95for.end:96 ret void97}98