================ @@ -8721,15 +8771,63 @@ bool LValueExprEvaluator::VisitMemberExpr(const MemberExpr *E) { return LValueExprEvaluatorBaseTy::VisitMemberExpr(E); } +bool LValueExprEvaluator::VisitExtVectorElementExpr( + const ExtVectorElementExpr *E) { + bool Success = true; + + APValue Val; + if (!Evaluate(Val, Info, E->getBase())) { + if (!Info.noteFailure()) + return false; + Success = false; + } + + SmallVector<uint32_t, 4> Indices; + E->getEncodedElementAccess(Indices); + // FIXME: support accessing more than one element + if (Indices.size() > 1) + return false; + + if (Success) { + Result.setFrom(Info.Ctx, Val); + const VectorType *VT = E->getBase()->getType()->castAs<VectorType>(); + HandleLValueVectorElement(Info, E, Result, VT->getElementType(), + VT->getNumElements(), Indices[0]); + } + + return Success; +} + bool LValueExprEvaluator::VisitArraySubscriptExpr(const ArraySubscriptExpr *E) { - // FIXME: Deal with vectors as array subscript bases. - if (E->getBase()->getType()->isVectorType() || - E->getBase()->getType()->isSveVLSBuiltinType()) + if (E->getBase()->getType()->isSveVLSBuiltinType()) return Error(E); APSInt Index; bool Success = true; + if (const VectorType *VT = E->getBase()->getType()->getAs<VectorType>()) { ---------------- AaronBallman wrote:
```suggestion if (const auto *VT = E->getBase()->getType()->getAs<VectorType>()) { ``` https://github.com/llvm/llvm-project/pull/72607 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits