aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2012-02-06 05:05:50 +0000
committerCraig Topper <craig.topper@gmail.com>2012-02-06 05:05:50 +0000
commit5fa560819d41857d80a224f80ebc1964e54c16eb (patch)
treea426ebd08fd4f0a656e7fd8573c8a719756947cb
parent41576d47d746dacd3d0753d00daf6e47ad4cab5d (diff)
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
-rw-r--r--lib/CodeGen/CGExprScalar.cpp2
1 files changed, 2 insertions, 0 deletions
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<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);