diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/CGExpr.cpp | 20 | ||||
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 2 |
2 files changed, 13 insertions, 9 deletions
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 3e44c0079b..03efbc9ad5 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -257,13 +257,8 @@ RValue CodeGenFunction::EmitLoadOfLValue(LValue LV, QualType ExprType) { if (LV.isPropertyRef()) return EmitLoadOfPropertyRefLValue(LV, ExprType); - if (LV.isKVCRef()) - return EmitLoadOfKVCRefLValue(LV, ExprType); - - assert(0 && "Unknown LValue type!"); - //an invalid RValue, but the assert will - //ensure that this point is never reached - return RValue(); + assert(LV.isKVCRef() && "Unknown LValue type!"); + return EmitLoadOfKVCRefLValue(LV, ExprType); } RValue CodeGenFunction::EmitLoadOfBitfieldLValue(LValue LV, @@ -799,7 +794,16 @@ llvm::Constant *GenerateConstantVector(llvm::SmallVector<unsigned, 4> &Elts) { LValue CodeGenFunction:: EmitExtVectorElementExpr(const ExtVectorElementExpr *E) { // Emit the base vector as an l-value. - LValue Base = EmitLValue(E->getBase()); + LValue Base; + + // ExtVectorElementExpr's base can either be a vector or pointer to vector. + if (const PointerType *PT = E->getBase()->getType()->getAsPointerType()) { + llvm::Value *Ptr = EmitScalarExpr(E->getBase()); + Base = LValue::MakeAddr(Ptr, PT->getPointeeType().getCVRQualifiers()); + } else { + assert(E->getBase()->getType()->isVectorType()); + Base = EmitLValue(E->getBase()); + } // Encode the element access list into a vector of unsigned indices. llvm::SmallVector<unsigned, 4> Indices; diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 9a44a087c7..ad4f297388 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -1815,7 +1815,7 @@ Sema::ActOnMemberReferenceExpr(Scope *S, ExprArg Base, SourceLocation OpLoc, << &Member << BaseType); } // Handle 'field access' to vectors, such as 'V.xx'. - if (BaseType->isExtVectorType() && OpKind == tok::period) { + if (BaseType->isExtVectorType()) { QualType ret = CheckExtVectorComponent(BaseType, OpLoc, Member, MemberLoc); if (ret.isNull()) return ExprError(); |