[cfe-commits] r40995 - /cfe/trunk/CodeGen/CGExpr.cpp
Chris Lattner
sabre at nondot.org
Fri Aug 10 10:10:08 PDT 2007
Author: lattner
Date: Fri Aug 10 12:10:08 2007
New Revision: 40995
URL: http://llvm.org/viewvc/llvm-project?rev=40995&view=rev
Log:
fix a codegen bug handling ocuvector element exprs.
Modified:
cfe/trunk/CodeGen/CGExpr.cpp
Modified: cfe/trunk/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CGExpr.cpp?rev=40995&r1=40994&r2=40995&view=diff
==============================================================================
--- cfe/trunk/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/CodeGen/CGExpr.cpp Fri Aug 10 12:10:08 2007
@@ -296,14 +296,15 @@
// If this is a reference to a subset of the elements of a vector, either
// shuffle the input or extract/insert them as appropriate.
RValue CodeGenFunction::EmitLoadOfOCUElementLValue(LValue LV,
- QualType ExprType) {
+ QualType ExprType) {
llvm::Value *Vec = Builder.CreateLoad(LV.getOCUVectorAddr(), "tmp");
unsigned EncFields = LV.getOCUVectorElts();
// If the result of the expression is a non-vector type, we must be
// extracting a single element. Just codegen as an extractelement.
- if (!isa<VectorType>(ExprType)) {
+ const VectorType *ExprVT = ExprType->getAsVectorType();
+ if (!ExprVT) {
unsigned InIdx = OCUVectorElementExpr::getAccessedFieldNo(0, EncFields);
llvm::Value *Elt = llvm::ConstantInt::get(llvm::Type::Int32Ty, InIdx);
return RValue::get(Builder.CreateExtractElement(Vec, Elt, "tmp"));
@@ -311,7 +312,7 @@
// If the source and destination have the same number of elements, use a
// vector shuffle instead of insert/extracts.
- unsigned NumResultElts = cast<VectorType>(ExprType)->getNumElements();
+ unsigned NumResultElts = ExprVT->getNumElements();
unsigned NumSourceElts =
cast<llvm::VectorType>(Vec->getType())->getNumElements();
More information about the cfe-commits
mailing list