Fix vector splat casts to cast element to the appropriate vector element before inserting into the vector. Fixes PR11930.

llvm-svn: 149855
This commit is contained in:
Craig Topper
2012-02-06 05:05:50 +00:00
parent 574e896976
commit 5b5935d17d

View File

@@ -1190,6 +1190,8 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) {
case CK_VectorSplat: {
llvm::Type *DstTy = ConvertType(DestTy);
Value *Elt = Visit(const_cast<Expr*>(E));
Elt = EmitScalarConversion(Elt, E->getType(),
DestTy->getAs<VectorType>()->getElementType());
// Insert the element in element zero of an undef vector
llvm::Value *UnV = llvm::UndefValue::get(DstTy);