96 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt < %s -passes=slp-vectorizer -S | FileCheck %s3; RUN: opt < %s -passes=slp-vectorizer -S -mattr=+avx | FileCheck %s4 5target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"6target triple = "x86_64-apple-macosx10.10.0"7 8define void @testfunc(ptr nocapture %dest, ptr nocapture readonly %src) {9; CHECK-LABEL: @testfunc(10; CHECK-NEXT: entry:11; CHECK-NEXT: br label [[FOR_BODY:%.*]]12; CHECK: for.body:13; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 0, [[ENTRY:%.*]] ], [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ]14; CHECK-NEXT: [[ACC1_056:%.*]] = phi float [ 0.000000e+00, [[ENTRY]] ], [ [[ADD13:%.*]], [[FOR_BODY]] ]15; CHECK-NEXT: [[TMP0:%.*]] = phi <2 x float> [ zeroinitializer, [[ENTRY]] ], [ [[TMP18:%.*]], [[FOR_BODY]] ]16; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds float, ptr [[SRC:%.*]], i64 [[INDVARS_IV]]17; CHECK-NEXT: [[TMP1:%.*]] = load float, ptr [[ARRAYIDX]], align 418; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 119; CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds float, ptr [[DEST:%.*]], i64 [[INDVARS_IV]]20; CHECK-NEXT: store float [[ACC1_056]], ptr [[ARRAYIDX2]], align 421; CHECK-NEXT: [[TMP2:%.*]] = insertelement <2 x float> poison, float [[TMP1]], i32 022; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <2 x float> [[TMP2]], <2 x float> poison, <2 x i32> zeroinitializer23; CHECK-NEXT: [[TMP3:%.*]] = fadd <2 x float> [[TMP0]], [[SHUFFLE]]24; CHECK-NEXT: [[SHUFFLE1:%.*]] = shufflevector <2 x float> [[TMP3]], <2 x float> poison, <2 x i32> <i32 1, i32 0>25; CHECK-NEXT: [[TMP4:%.*]] = fmul <2 x float> [[TMP0]], zeroinitializer26; CHECK-NEXT: [[TMP5:%.*]] = fadd <2 x float> [[TMP4]], [[SHUFFLE1]]27; CHECK-NEXT: [[TMP8:%.*]] = fcmp olt <2 x float> [[TMP5]], splat (float 1.000000e+00)28; CHECK-NEXT: [[TMP7:%.*]] = select <2 x i1> [[TMP8]], <2 x float> [[TMP5]], <2 x float> splat (float 1.000000e+00)29; CHECK-NEXT: [[TMP15:%.*]] = fcmp olt <2 x float> [[TMP7]], splat (float -1.000000e+00)30; CHECK-NEXT: [[TMP9:%.*]] = fmul <2 x float> [[TMP7]], zeroinitializer31; CHECK-NEXT: [[TMP10:%.*]] = select <2 x i1> [[TMP15]], <2 x float> splat (float -0.000000e+00), <2 x float> [[TMP9]]32; CHECK-NEXT: [[TMP11:%.*]] = extractelement <2 x float> [[TMP10]], i32 033; CHECK-NEXT: [[TMP12:%.*]] = extractelement <2 x float> [[TMP10]], i32 134; CHECK-NEXT: [[ADD13]] = fadd float [[TMP11]], [[TMP12]]35; CHECK-NEXT: [[TMP13:%.*]] = shufflevector <2 x float> [[TMP10]], <2 x float> poison, <2 x i32> <i32 1, i32 poison>36; CHECK-NEXT: [[TMP14:%.*]] = insertelement <2 x float> [[TMP13]], float [[ADD13]], i32 137; CHECK-NEXT: [[TMP17:%.*]] = fcmp olt <2 x float> [[TMP14]], splat (float 1.000000e+00)38; CHECK-NEXT: [[TMP20:%.*]] = select <2 x i1> [[TMP17]], <2 x float> [[TMP14]], <2 x float> splat (float 1.000000e+00)39; CHECK-NEXT: [[TMP19:%.*]] = fcmp olt <2 x float> [[TMP20]], splat (float -1.000000e+00)40; CHECK-NEXT: [[TMP18]] = select <2 x i1> [[TMP19]], <2 x float> splat (float -1.000000e+00), <2 x float> [[TMP20]]41; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[INDVARS_IV_NEXT]], 3242; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_END:%.*]], label [[FOR_BODY]]43; CHECK: for.end:44; CHECK-NEXT: ret void45;46entry:47 br label %for.body48 49for.body:50 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]51 %acc1.056 = phi float [ 0.000000e+00, %entry ], [ %add13, %for.body ]52 %s1.055 = phi float [ 0.000000e+00, %entry ], [ %cond.i40, %for.body ]53 %s0.054 = phi float [ 0.000000e+00, %entry ], [ %cond.i44, %for.body ]54 %arrayidx = getelementptr inbounds float, ptr %src, i64 %indvars.iv55 %0 = load float, ptr %arrayidx, align 456 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 157 %arrayidx2 = getelementptr inbounds float, ptr %dest, i64 %indvars.iv58 store float %acc1.056, ptr %arrayidx2, align 459 %add = fadd float %s0.054, %060 %add3 = fadd float %s1.055, %061 %mul = fmul float %s0.054, 0.000000e+0062 %add4 = fadd float %mul, %add363 %mul5 = fmul float %s1.055, 0.000000e+0064 %add6 = fadd float %mul5, %add65 %cmp.i = fcmp olt float %add6, 1.000000e+0066 %cond.i = select i1 %cmp.i, float %add6, float 1.000000e+0067 %cmp.i51 = fcmp olt float %cond.i, -1.000000e+0068 %cmp.i49 = fcmp olt float %add4, 1.000000e+0069 %cond.i50 = select i1 %cmp.i49, float %add4, float 1.000000e+0070 %cmp.i47 = fcmp olt float %cond.i50, -1.000000e+0071 %cond.i.op = fmul float %cond.i, 0.000000e+0072 %mul10 = select i1 %cmp.i51, float -0.000000e+00, float %cond.i.op73 %cond.i50.op = fmul float %cond.i50, 0.000000e+0074 %mul11 = select i1 %cmp.i47, float -0.000000e+00, float %cond.i50.op75 %add13 = fadd float %mul10, %mul1176 77 ; The SLPVectorizer crashed in vectorizeChainsInBlock() because it tried78 ; to access the second operand of the following cmp after the cmp itself79 ; was already vectorized and deleted.80 %cmp.i45 = fcmp olt float %add13, 1.000000e+0081 82 %cond.i46 = select i1 %cmp.i45, float %add13, float 1.000000e+0083 %cmp.i43 = fcmp olt float %cond.i46, -1.000000e+0084 %cond.i44 = select i1 %cmp.i43, float -1.000000e+00, float %cond.i4685 %cmp.i41 = fcmp olt float %mul11, 1.000000e+0086 %cond.i42 = select i1 %cmp.i41, float %mul11, float 1.000000e+0087 %cmp.i39 = fcmp olt float %cond.i42, -1.000000e+0088 %cond.i40 = select i1 %cmp.i39, float -1.000000e+00, float %cond.i4289 %exitcond = icmp eq i64 %indvars.iv.next, 3290 br i1 %exitcond, label %for.end, label %for.body91 92for.end:93 ret void94}95 96