diff --git a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp index a133d5433a57..1474ed0d5c69 100644 --- a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp +++ b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp @@ -395,8 +395,9 @@ static bool scalarizeBinopOrCmp(Instruction &I, Type *VecTy = I.getType(); assert(VecTy->isVectorTy() && (IsConst0 || IsConst1 || V0->getType() == V1->getType()) && - (ScalarTy->isIntegerTy() || ScalarTy->isFloatingPointTy()) && - "Unexpected types for insert into binop"); + (ScalarTy->isIntegerTy() || ScalarTy->isFloatingPointTy() || + ScalarTy->isPointerTy()) && + "Unexpected types for insert element into binop or cmp"); unsigned Opcode = I.getOpcode(); int ScalarOpCost, VectorOpCost; diff --git a/llvm/test/Transforms/VectorCombine/X86/scalarize-cmp.ll b/llvm/test/Transforms/VectorCombine/X86/scalarize-cmp.ll index fe2d1f0a5597..4774f64d08b5 100644 --- a/llvm/test/Transforms/VectorCombine/X86/scalarize-cmp.ll +++ b/llvm/test/Transforms/VectorCombine/X86/scalarize-cmp.ll @@ -277,3 +277,14 @@ define <4 x float> @vec_select_use2(<4 x float> %x, <4 x float> %y, float %a) { %r = select <4 x i1> %cond, <4 x float> %x, <4 x float> %y ret <4 x float> %r } + +define <4 x i1> @vector_of_pointers(i32* %t1) { +; CHECK-LABEL: @vector_of_pointers( +; CHECK-NEXT: [[T6_SCALAR:%.*]] = icmp ne i32* [[T1:%.*]], null +; CHECK-NEXT: [[T6:%.*]] = insertelement <4 x i1> undef, i1 [[T6_SCALAR]], i64 0 +; CHECK-NEXT: ret <4 x i1> [[T6]] +; + %t5 = insertelement <4 x i32*> undef, i32* %t1, i32 0 + %t6 = icmp ne <4 x i32*> %t5, zeroinitializer + ret <4 x i1> %t6 +}