diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h --- a/clang/include/clang/AST/Type.h +++ b/clang/include/clang/AST/Type.h @@ -2055,7 +2055,7 @@ /// Determines if this is a sizeless type supported by the /// 'arm_sve_vector_bits' type attribute, which can be applied to a single /// SVE vector or predicate, excluding tuple types such as svint32x4_t. - bool isVLSTBuiltinType() const; + bool isSVEVLSTBuiltinType() const; /// Returns the representative type for the element of an SVE builtin type. /// This is used to represent fixed-length SVE vectors created with the diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -9461,7 +9461,7 @@ /// getSVETypeSize - Return SVE vector or predicate register size. static uint64_t getSVETypeSize(ASTContext &Context, const BuiltinType *Ty) { - assert(Ty->isVLSTBuiltinType() && "Invalid SVE Type"); + assert(Ty->isSVEVLSTBuiltinType() && "Invalid SVE Type"); if (Ty->getKind() == BuiltinType::SveBool || Ty->getKind() == BuiltinType::SveCount) return (Context.getLangOpts().VScaleMin * 128) / Context.getCharWidth(); diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -8569,7 +8569,7 @@ bool LValueExprEvaluator::VisitArraySubscriptExpr(const ArraySubscriptExpr *E) { // FIXME: Deal with vectors as array subscript bases. if (E->getBase()->getType()->isVectorType() || - E->getBase()->getType()->isVLSTBuiltinType()) + E->getBase()->getType()->isSVEVLSTBuiltinType()) return Error(E); APSInt Index; diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp --- a/clang/lib/AST/Type.cpp +++ b/clang/lib/AST/Type.cpp @@ -1943,7 +1943,7 @@ bool Type::hasIntegerRepresentation() const { if (const auto *VT = dyn_cast(CanonicalType)) return VT->getElementType()->isIntegerType(); - if (CanonicalType->isVLSTBuiltinType()) { + if (CanonicalType->isSVEVLSTBuiltinType()) { const auto *VT = cast(CanonicalType); return VT->getKind() == BuiltinType::SveBool || (VT->getKind() >= BuiltinType::SveInt8 && @@ -2160,7 +2160,7 @@ return VT->getElementType()->isUnsignedIntegerOrEnumerationType(); if (const auto *VT = dyn_cast(CanonicalType)) return VT->getElementType()->isUnsignedIntegerOrEnumerationType(); - if (CanonicalType->isVLSTBuiltinType()) { + if (CanonicalType->isSVEVLSTBuiltinType()) { const auto *VT = cast(CanonicalType); return VT->getKind() >= BuiltinType::SveUint8 && VT->getKind() <= BuiltinType::SveUint64; @@ -2414,7 +2414,7 @@ return false; } -bool Type::isVLSTBuiltinType() const { +bool Type::isSVEVLSTBuiltinType() const { if (const BuiltinType *BT = getAs()) { switch (BT->getKind()) { case BuiltinType::SveInt8: @@ -2441,7 +2441,7 @@ } QualType Type::getSveEltType(const ASTContext &Ctx) const { - assert(isVLSTBuiltinType() && "unsupported type!"); + assert(isSVEVLSTBuiltinType() && "unsupported type!"); const BuiltinType *BTy = castAs(); if (BTy->getKind() == BuiltinType::SveBool) diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/lib/CodeGen/CGExprScalar.cpp @@ -1798,7 +1798,7 @@ // careful, because the base of a vector subscript is occasionally an rvalue, // so we can't get it as an lvalue. if (!E->getBase()->getType()->isVectorType() && - !E->getBase()->getType()->isVLSTBuiltinType()) + !E->getBase()->getType()->isSVEVLSTBuiltinType()) return EmitLoadOfLValue(E); // Handle the vector case. The base must be a vector, the index must be an @@ -4858,7 +4858,7 @@ } if (condExpr->getType()->isVectorType() || - condExpr->getType()->isVLSTBuiltinType()) { + condExpr->getType()->isSVEVLSTBuiltinType()) { CGF.incrementProfileCounter(E); llvm::Value *CondV = CGF.EmitScalarExpr(condExpr); diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -14827,7 +14827,7 @@ // Strip vector types. if (isa(Source)) { - if (Target->isVLSTBuiltinType() && + if (Target->isSVEVLSTBuiltinType() && (S.Context.areCompatibleSveTypes(QualType(Target, 0), QualType(Source, 0)) || S.Context.areLaxCompatibleSveTypes(QualType(Target, 0), @@ -14878,7 +14878,7 @@ const BuiltinType *TargetBT = dyn_cast(Target); // Strip SVE vector types - if (SourceBT && SourceBT->isVLSTBuiltinType()) { + if (SourceBT && SourceBT->isSVEVLSTBuiltinType()) { // Need the original target type for vector type checks const Type *OriginalTarget = S.Context.getCanonicalType(T).getTypePtr(); // Handle conversion from scalable to fixed when msve-vector-bits is @@ -14897,7 +14897,7 @@ Source = SourceBT->getSveEltType(S.Context).getTypePtr(); } - if (TargetBT && TargetBT->isVLSTBuiltinType()) + if (TargetBT && TargetBT->isSVEVLSTBuiltinType()) Target = TargetBT->getSveEltType(S.Context).getTypePtr(); // If the source is floating point... diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -5945,7 +5945,7 @@ if (Combined != MemberQuals) ResultType = Context.getQualifiedType(ResultType, Combined); } else if (LHSTy->isBuiltinType() && - LHSTy->getAs()->isVLSTBuiltinType()) { + LHSTy->getAs()->isSVEVLSTBuiltinType()) { const BuiltinType *BTy = LHSTy->getAs(); if (BTy->isSVEBool()) return ExprError(Diag(LLoc, diag::err_subscript_svbool_t) @@ -10934,7 +10934,7 @@ assert(!isa(VT) && "ExtVectorTypes should not be handled here!"); VectorEltTy = VT->getElementType(); - } else if (VectorTy->isVLSTBuiltinType()) { + } else if (VectorTy->isSVEVLSTBuiltinType()) { VectorEltTy = VectorTy->castAs()->getSveEltType(S.getASTContext()); } else { @@ -11297,25 +11297,25 @@ if (Context.hasSameType(LHSType, RHSType)) return LHSType; - if (LHSType->isVLSTBuiltinType() && !RHSType->isVLSTBuiltinType()) { + if (LHSType->isSVEVLSTBuiltinType() && !RHSType->isSVEVLSTBuiltinType()) { if (!tryGCCVectorConvertAndSplat(*this, &RHS, &LHS)) return LHSType; } - if (RHSType->isVLSTBuiltinType() && !LHSType->isVLSTBuiltinType()) { + if (RHSType->isSVEVLSTBuiltinType() && !LHSType->isSVEVLSTBuiltinType()) { if (LHS.get()->isLValue() || !tryGCCVectorConvertAndSplat(*this, &LHS, &RHS)) return RHSType; } - if ((!LHSType->isVLSTBuiltinType() && !LHSType->isRealType()) || - (!RHSType->isVLSTBuiltinType() && !RHSType->isRealType())) { + if ((!LHSType->isSVEVLSTBuiltinType() && !LHSType->isRealType()) || + (!RHSType->isSVEVLSTBuiltinType() && !RHSType->isRealType())) { Diag(Loc, diag::err_typecheck_vector_not_convertable_non_scalar) << LHSType << RHSType << LHS.get()->getSourceRange() << RHS.get()->getSourceRange(); return QualType(); } - if (LHSType->isVLSTBuiltinType() && RHSType->isVLSTBuiltinType() && + if (LHSType->isSVEVLSTBuiltinType() && RHSType->isSVEVLSTBuiltinType() && Context.getBuiltinVectorTypeInfo(LHSBuiltinTy).EC != Context.getBuiltinVectorTypeInfo(RHSBuiltinTy).EC) { Diag(Loc, diag::err_typecheck_vector_lengths_not_equal) @@ -11324,11 +11324,11 @@ return QualType(); } - if (LHSType->isVLSTBuiltinType() || RHSType->isVLSTBuiltinType()) { - QualType Scalar = LHSType->isVLSTBuiltinType() ? RHSType : LHSType; - QualType Vector = LHSType->isVLSTBuiltinType() ? LHSType : RHSType; + if (LHSType->isSVEVLSTBuiltinType() || RHSType->isSVEVLSTBuiltinType()) { + QualType Scalar = LHSType->isSVEVLSTBuiltinType() ? RHSType : LHSType; + QualType Vector = LHSType->isSVEVLSTBuiltinType() ? LHSType : RHSType; bool ScalarOrVector = - LHSType->isVLSTBuiltinType() && RHSType->isVLSTBuiltinType(); + LHSType->isSVEVLSTBuiltinType() && RHSType->isSVEVLSTBuiltinType(); Diag(Loc, diag::err_typecheck_vector_not_convertable_implict_truncation) << ScalarOrVector << Scalar << Vector; @@ -11454,7 +11454,7 @@ /*AllowBoolConversions*/ false, /*AllowBooleanOperation*/ false, /*ReportInvalid*/ true); - if (LHSTy->isVLSTBuiltinType() || RHSTy->isVLSTBuiltinType()) + if (LHSTy->isSVEVLSTBuiltinType() || RHSTy->isSVEVLSTBuiltinType()) return CheckSizelessVectorOperands(LHS, RHS, Loc, IsCompAssign, ACK_Arithmetic); if (!IsDiv && @@ -11496,8 +11496,8 @@ return InvalidOperands(Loc, LHS, RHS); } - if (LHS.get()->getType()->isVLSTBuiltinType() || - RHS.get()->getType()->isVLSTBuiltinType()) { + if (LHS.get()->getType()->isSVEVLSTBuiltinType() || + RHS.get()->getType()->isSVEVLSTBuiltinType()) { if (LHS.get()->getType()->hasIntegerRepresentation() && RHS.get()->getType()->hasIntegerRepresentation()) return CheckSizelessVectorOperands(LHS, RHS, Loc, IsCompAssign, @@ -11815,8 +11815,8 @@ return compType; } - if (LHS.get()->getType()->isVLSTBuiltinType() || - RHS.get()->getType()->isVLSTBuiltinType()) { + if (LHS.get()->getType()->isSVEVLSTBuiltinType() || + RHS.get()->getType()->isSVEVLSTBuiltinType()) { QualType compType = CheckSizelessVectorOperands(LHS, RHS, Loc, CompLHSTy, ACK_Arithmetic); if (CompLHSTy) @@ -11930,8 +11930,8 @@ return compType; } - if (LHS.get()->getType()->isVLSTBuiltinType() || - RHS.get()->getType()->isVLSTBuiltinType()) { + if (LHS.get()->getType()->isSVEVLSTBuiltinType() || + RHS.get()->getType()->isSVEVLSTBuiltinType()) { QualType compType = CheckSizelessVectorOperands(LHS, RHS, Loc, CompLHSTy, ACK_Arithmetic); if (CompLHSTy) @@ -12270,14 +12270,14 @@ QualType LHSType = LHS.get()->getType(); const BuiltinType *LHSBuiltinTy = LHSType->castAs(); - QualType LHSEleType = LHSType->isVLSTBuiltinType() + QualType LHSEleType = LHSType->isSVEVLSTBuiltinType() ? LHSBuiltinTy->getSveEltType(S.getASTContext()) : LHSType; // Note that RHS might not be a vector QualType RHSType = RHS.get()->getType(); const BuiltinType *RHSBuiltinTy = RHSType->castAs(); - QualType RHSEleType = RHSType->isVLSTBuiltinType() + QualType RHSEleType = RHSType->isSVEVLSTBuiltinType() ? RHSBuiltinTy->getSveEltType(S.getASTContext()) : RHSType; @@ -12300,7 +12300,7 @@ return QualType(); } - if (LHSType->isVLSTBuiltinType() && RHSType->isVLSTBuiltinType() && + if (LHSType->isSVEVLSTBuiltinType() && RHSType->isSVEVLSTBuiltinType() && (S.Context.getBuiltinVectorTypeInfo(LHSBuiltinTy).EC != S.Context.getBuiltinVectorTypeInfo(RHSBuiltinTy).EC)) { S.Diag(Loc, diag::err_typecheck_invalid_operands) @@ -12309,8 +12309,8 @@ return QualType(); } - if (!LHSType->isVLSTBuiltinType()) { - assert(RHSType->isVLSTBuiltinType()); + if (!LHSType->isSVEVLSTBuiltinType()) { + assert(RHSType->isSVEVLSTBuiltinType()); if (IsCompAssign) return RHSType; if (LHSEleType != RHSEleType) { @@ -12323,7 +12323,7 @@ S.Context.getScalableVectorType(LHSEleType, VecSize.getKnownMinValue()); LHS = S.ImpCastExprToType(LHS.get(), VecTy, clang::CK_VectorSplat); LHSType = VecTy; - } else if (RHSBuiltinTy && RHSBuiltinTy->isVLSTBuiltinType()) { + } else if (RHSBuiltinTy && RHSBuiltinTy->isSVEVLSTBuiltinType()) { if (S.Context.getTypeSize(RHSBuiltinTy) != S.Context.getTypeSize(LHSBuiltinTy)) { S.Diag(Loc, diag::err_typecheck_vector_lengths_not_equal) @@ -12369,8 +12369,8 @@ return checkVectorShift(*this, LHS, RHS, Loc, IsCompAssign); } - if (LHS.get()->getType()->isVLSTBuiltinType() || - RHS.get()->getType()->isVLSTBuiltinType()) + if (LHS.get()->getType()->isSVEVLSTBuiltinType() || + RHS.get()->getType()->isSVEVLSTBuiltinType()) return checkSizelessVectorShift(*this, LHS, RHS, Loc, IsCompAssign); // Shifts don't perform usual arithmetic conversions, they just do integer @@ -13059,8 +13059,8 @@ RHS.get()->getType()->isVectorType()) return CheckVectorCompareOperands(LHS, RHS, Loc, Opc); - if (LHS.get()->getType()->isVLSTBuiltinType() || - RHS.get()->getType()->isVLSTBuiltinType()) + if (LHS.get()->getType()->isSVEVLSTBuiltinType() || + RHS.get()->getType()->isSVEVLSTBuiltinType()) return CheckSizelessVectorCompareOperands(LHS, RHS, Loc, Opc); diagnoseLogicalNotOnLHSofCheck(*this, LHS, RHS, Loc, Opc); @@ -13935,8 +13935,8 @@ return InvalidOperands(Loc, LHS, RHS); } - if (LHS.get()->getType()->isVLSTBuiltinType() || - RHS.get()->getType()->isVLSTBuiltinType()) { + if (LHS.get()->getType()->isSVEVLSTBuiltinType() || + RHS.get()->getType()->isSVEVLSTBuiltinType()) { if (LHS.get()->getType()->hasIntegerRepresentation() && RHS.get()->getType()->hasIntegerRepresentation()) return CheckSizelessVectorOperands(LHS, RHS, Loc, IsCompAssign, @@ -13944,8 +13944,8 @@ return InvalidOperands(Loc, LHS, RHS); } - if (LHS.get()->getType()->isVLSTBuiltinType() || - RHS.get()->getType()->isVLSTBuiltinType()) { + if (LHS.get()->getType()->isSVEVLSTBuiltinType() || + RHS.get()->getType()->isSVEVLSTBuiltinType()) { if (LHS.get()->getType()->hasIntegerRepresentation() && RHS.get()->getType()->hasIntegerRepresentation()) return CheckSizelessVectorOperands(LHS, RHS, Loc, IsCompAssign, @@ -16309,7 +16309,7 @@ resultType->castAs()->getVectorKind() != VectorType::AltiVecBool)) break; - else if (resultType->isVLSTBuiltinType()) // SVE vectors allow + and - + else if (resultType->isSVEVLSTBuiltinType()) // SVE vectors allow + and - break; else if (getLangOpts().CPlusPlus && // C++ [expr.unary.op]p6 Opc == UO_Plus && diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -6305,7 +6305,7 @@ static bool isValidSizelessVectorForConditionalCondition(ASTContext &Ctx, QualType CondTy) { - if (!CondTy->isVLSTBuiltinType()) + if (!CondTy->isSVEVLSTBuiltinType()) return false; const QualType EltTy = cast(CondTy.getCanonicalType())->getSveEltType(Ctx); @@ -6417,10 +6417,10 @@ QualType LHSType = LHS.get()->getType(); const auto *LHSBT = - LHSType->isVLSTBuiltinType() ? LHSType->getAs() : nullptr; + LHSType->isSVEVLSTBuiltinType() ? LHSType->getAs() : nullptr; QualType RHSType = RHS.get()->getType(); const auto *RHSBT = - RHSType->isVLSTBuiltinType() ? RHSType->getAs() : nullptr; + RHSType->isSVEVLSTBuiltinType() ? RHSType->getAs() : nullptr; QualType ResultType; @@ -6462,7 +6462,7 @@ RHS = ImpCastExprToType(RHS.get(), ResultType, CK_VectorSplat); } - assert(!ResultType.isNull() && ResultType->isVLSTBuiltinType() && + assert(!ResultType.isNull() && ResultType->isSVEVLSTBuiltinType() && "Result should have been a vector type"); auto *ResultBuiltinTy = ResultType->castAs(); QualType ResultElementTy = ResultBuiltinTy->getSveEltType(Context); diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -8363,7 +8363,7 @@ } // Attribute can only be attached to a single SVE vector or predicate type. - if (!CurType->isVLSTBuiltinType()) { + if (!CurType->isSVEVLSTBuiltinType()) { S.Diag(Attr.getLoc(), diag::err_attribute_invalid_sve_type) << Attr << CurType; Attr.setInvalid();