Only OCU vectors can be splatted.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46651 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/CodeGen/CGExprScalar.cpp b/CodeGen/CGExprScalar.cpp
index 8202340..c812e21 100644
--- a/CodeGen/CGExprScalar.cpp
+++ b/CodeGen/CGExprScalar.cpp
@@ -370,8 +370,8 @@
return Builder.CreatePtrToInt(Src, DstTy, "conv");
}
- // A scalar source can be splatted to a vector of the same element type
- if (isa<llvm::VectorType>(DstTy) && !isa<VectorType>(SrcType)) {
+ // A scalar source can be splatted to an OCU vector of the same element type
+ if (DstType->isOCUVectorType() && !isa<VectorType>(SrcType)) {
const llvm::VectorType *VT = cast<llvm::VectorType>(DstTy);
assert((VT->getElementType() == Src->getType()) &&
"Vector element type must match scalar type to splat.");