Index: lib/Transforms/Vectorize/SLPVectorizer.cpp =================================================================== --- lib/Transforms/Vectorize/SLPVectorizer.cpp +++ lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -1014,7 +1014,7 @@ void BoUpSLP::buildTree_rec(ArrayRef VL, unsigned Depth) { - bool SameTy = getSameType(VL); (void)SameTy; + bool SameTy = allConstant(VL) || getSameType(VL); (void)SameTy; bool isAltShuffle = false; assert(SameTy && "Invalid types!"); Index: test/Transforms/SLPVectorizer/X86/gep_mismatch.ll =================================================================== --- /dev/null +++ test/Transforms/SLPVectorizer/X86/gep_mismatch.ll @@ -0,0 +1,39 @@ +; RUN: opt < %s -S -mcpu=x86-64 -mtriple=x86_64-linux -indvars -slp-vectorizer -O1 + +; This code will result in GEPs with different index types, i8 and i64, +; which should not matter for the SLPVectorizer. + +target datalayout = "E-B16-p:16:16-p20:32:16-p21:32:16-p40:32:16-F40-i1:16-i8:16-i32:16-i64:16-f32:16-f64:16-v32:16:16-v64:16:16-v128:16:16-a:0:16-i24:16-i40:16-n16:32" +target triple = "x86_64-unknown-linux-gnu" + +define void @matmul([4 x float]* noalias %r.8.par, [4 x float]* %x.9.par, [4 x float]* %y.10.par) #3 { + %ls3.16 = alloca float* + %ls6.18 = alloca float* + %ls7.19 = alloca float* + br label %bb3 + +bb3: + %_tmp22 = load float*, float** %ls7.19 + store float* %_tmp22, float** %ls3.16 + %_tmp23 = load float*, float** %ls3.16 + %_tmp24 = load float, float* %_tmp23 + %_tmp27 = fmul float %_tmp24, undef + %_tmp50 = load float*, float** %ls6.18 + store float undef, float* %_tmp50 + %_tmp55 = load float*, float** %ls6.18 + %_tmp56 = getelementptr float, float* %_tmp55, i64 1 + store float* %_tmp56, float** %ls6.18 + br i1 undef, label %bb3, label %bb8 + +bb8: + %_tmp61 = load float*, float** %ls7.19 + %_tmp62 = getelementptr float, float* %_tmp61, i64 4 + store float* %_tmp62, float** %ls7.19 + %_tmp64 = icmp slt i16 undef, 4 + br i1 %_tmp64, label %bb3, label %bb9 + +bb9: + ret void +} + +declare void @TEST__MAIN() #3