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
This commit is contained in:
Chris Lattner 2007-08-10 17:10:08 +00:00
Родитель 12b2be25f8
Коммит cf60cd291e
1 изменённых файлов: 4 добавлений и 3 удалений

Просмотреть файл

@ -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();