[cfe-commits] r74324 - /cfe/trunk/lib/CodeGen/CGExpr.cpp
Nate Begeman
natebegeman at mac.com
Fri Jun 26 14:12:50 PDT 2009
Author: sampo
Date: Fri Jun 26 16:12:50 2009
New Revision: 74324
URL: http://llvm.org/viewvc/llvm-project?rev=74324&view=rev
Log:
OpenCL 1.0 Support: fix a bug with lvalue swizzles
Modified:
cfe/trunk/lib/CodeGen/CGExpr.cpp
Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=74324&r1=74323&r2=74324&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Fri Jun 26 16:12:50 2009
@@ -606,11 +606,12 @@
cast<llvm::VectorType>(Vec->getType())->getNumElements();
if (NumDstElts == NumSrcElts) {
// Use shuffle vector is the src and destination are the same number
- // of elements
- llvm::SmallVector<llvm::Constant*, 4> Mask;
+ // of elements and restore the vector mask since it is on the side
+ // it will be stored.
+ llvm::SmallVector<llvm::Constant*, 4> Mask(NumDstElts);
for (unsigned i = 0; i != NumSrcElts; ++i) {
unsigned InIdx = getAccessedFieldNo(i, Elts);
- Mask.push_back(llvm::ConstantInt::get(llvm::Type::Int32Ty, InIdx));
+ Mask[InIdx] = llvm::ConstantInt::get(llvm::Type::Int32Ty, i);
}
llvm::Value *MaskV = llvm::ConstantVector::get(&Mask[0], Mask.size());
More information about the cfe-commits
mailing list