diff options
author | Chris Lattner <sabre@nondot.org> | 2007-08-10 17:10:08 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-08-10 17:10:08 +0000 |
commit | cf60cd291e8b33274a9622b7ec1818c29e90e7d4 (patch) | |
tree | 60048e350b439541aa1296a723f4cbc7c525403a /CodeGen/CGExpr.cpp | |
parent | 12b2be25f8575fb0a1f6ecf5802e3bcb78af6ada (diff) |
fix a codegen bug handling ocuvector element exprs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40995 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CodeGen/CGExpr.cpp')
-rw-r--r-- | CodeGen/CGExpr.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/CodeGen/CGExpr.cpp b/CodeGen/CGExpr.cpp index 08bd93f22d..8937eaffba 100644 --- a/CodeGen/CGExpr.cpp +++ b/CodeGen/CGExpr.cpp @@ -296,14 +296,15 @@ RValue CodeGenFunction::EmitLoadOfLValue(LValue LV, QualType ExprType) { // 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 @@ RValue CodeGenFunction::EmitLoadOfOCUElementLValue(LValue LV, // 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(); |