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,23 @@ +; RUN: opt < %s -S -mcpu=x86-64 -mtriple=x86_64-linux -slp-vectorizer + +; This code has GEPs with different index types, which should not +; matter for the SLPVectorizer. + +target triple = "x86_64--linux" + +define void @matmul() #0 { + br label %bb1 + +bb1: ; preds = %bb1, %0 + %ls1.ph = phi float* [ %_tmp1, %bb1 ], [ undef, %0 ] + %ls2.ph = phi float* [ %_tmp2, %bb1 ], [ undef, %0 ] + store float undef, float* %ls1.ph + %_tmp1 = getelementptr float, float* %ls1.ph, i32 1 + %_tmp2 = getelementptr float, float* %ls2.ph, i64 4 + br i1 false, label %bb1, label %bb2 + +bb2: ; preds = %bb1 + ret void +} + +attributes #0 = { "target-cpu"="x86-64" }