[clang] [Clang][AArch64][SVE] Allow write to SVE vector elements using the subscript operator (PR #91965)
Momchil Velikov via cfe-commits
cfe-commits at lists.llvm.org
Fri May 17 05:20:00 PDT 2024
================
@@ -4180,8 +4180,10 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E,
// If the base is a vector type, then we are forming a vector element lvalue
// with this subscript.
- if (E->getBase()->getType()->isVectorType() &&
- !isa<ExtVectorElementExpr>(E->getBase())) {
+ if (QualType BaseTy = E->getBase()->getType();
+ (BaseTy->isVectorType() && !isa<ExtVectorElementExpr>(E->getBase())) ||
+ (BaseTy->isBuiltinType() &&
+ BaseTy->getAs<BuiltinType>()->isSveVLSBuiltinType())) {
----------------
momchil-velikov wrote:
AFAICT here https://github.com/llvm/llvm-project/blob/371eccd5dfed88c8e76449233d8388c12be3464b/clang/lib/Sema/SemaExpr.cpp#L5307 we are enabling array subscripts for SVE only.
Perhaps we can be generalised to any size-less vector type, in a followup patch, @jacquesguan , what do you think?
https://github.com/llvm/llvm-project/pull/91965
More information about the cfe-commits
mailing list