diff --git a/clang/CodeGen/CGExprScalar.cpp b/clang/CodeGen/CGExprScalar.cpp index c812e21437af..6db7beed0bd0 100644 --- a/clang/CodeGen/CGExprScalar.cpp +++ b/clang/CodeGen/CGExprScalar.cpp @@ -371,18 +371,15 @@ Value *ScalarExprEmitter::EmitScalarConversion(Value *Src, QualType SrcType, } // A scalar source can be splatted to an OCU vector of the same element type - if (DstType->isOCUVectorType() && !isa(SrcType)) { - const llvm::VectorType *VT = cast(DstTy); - assert((VT->getElementType() == Src->getType()) && - "Vector element type must match scalar type to splat."); + if (DstType->isOCUVectorType() && !isa(SrcType) && + cast(DstTy)->getElementType() == Src->getType()) return CGF.EmitVector(&Src, DstType->getAsVectorType()->getNumElements(), true); - } + // Allow bitcast from vector to integer/fp of the same size. if (isa(Src->getType()) || - isa(DstTy)) { + isa(DstTy)) return Builder.CreateBitCast(Src, DstTy, "conv"); - } // Finally, we have the arithmetic types: real int/float. if (isa(Src->getType())) {