From: Craig Topper Date: Mon, 6 Feb 2012 05:05:50 +0000 (+0000) Subject: Fix vector splat casts to cast element to the appropriate vector element before inser... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5fa560819d41857d80a224f80ebc1964e54c16eb;p=clang Fix vector splat casts to cast element to the appropriate vector element before inserting into the vector. Fixes PR11930. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149855 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp index 1833a9083d..6f0d99f2f5 100644 --- a/lib/CodeGen/CGExprScalar.cpp +++ b/lib/CodeGen/CGExprScalar.cpp @@ -1190,6 +1190,8 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) { case CK_VectorSplat: { llvm::Type *DstTy = ConvertType(DestTy); Value *Elt = Visit(const_cast(E)); + Elt = EmitScalarConversion(Elt, E->getType(), + DestTy->getAs()->getElementType()); // Insert the element in element zero of an undef vector llvm::Value *UnV = llvm::UndefValue::get(DstTy);