diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h index ed424ffb74801..46dbadd8b878b 100644 --- a/clang/include/clang/AST/Type.h +++ b/clang/include/clang/AST/Type.h @@ -2075,7 +2075,7 @@ class alignas(8) Type : public ExtQualsTypeCommonBase { /// 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 isSveVLSBuiltinType() 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 index 7acacd7bf4f50..1ca53d00ea1a7 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -9461,7 +9461,7 @@ bool ASTContext::areCompatibleVectorTypes(QualType FirstVec, /// 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->isSveVLSBuiltinType() && "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 index e3569be5549cf..9ee9fccfd461f 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -8572,7 +8572,7 @@ bool LValueExprEvaluator::VisitMemberExpr(const MemberExpr *E) { 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()->isSveVLSBuiltinType()) return Error(E); APSInt Index; diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp index e023cb46b9bb8..8173e08204820 100644 --- a/clang/lib/AST/Type.cpp +++ b/clang/lib/AST/Type.cpp @@ -1962,7 +1962,7 @@ bool Type::hasAutoForTrailingReturnType() const { bool Type::hasIntegerRepresentation() const { if (const auto *VT = dyn_cast(CanonicalType)) return VT->getElementType()->isIntegerType(); - if (CanonicalType->isVLSTBuiltinType()) { + if (CanonicalType->isSveVLSBuiltinType()) { const auto *VT = cast(CanonicalType); return VT->getKind() == BuiltinType::SveBool || (VT->getKind() >= BuiltinType::SveInt8 && @@ -2179,7 +2179,7 @@ bool Type::hasUnsignedIntegerRepresentation() const { return VT->getElementType()->isUnsignedIntegerOrEnumerationType(); if (const auto *VT = dyn_cast(CanonicalType)) return VT->getElementType()->isUnsignedIntegerOrEnumerationType(); - if (CanonicalType->isVLSTBuiltinType()) { + if (CanonicalType->isSveVLSBuiltinType()) { const auto *VT = cast(CanonicalType); return VT->getKind() >= BuiltinType::SveUint8 && VT->getKind() <= BuiltinType::SveUint64; @@ -2433,7 +2433,7 @@ bool Type::isRVVSizelessBuiltinType() const { return false; } -bool Type::isVLSTBuiltinType() const { +bool Type::isSveVLSBuiltinType() const { if (const BuiltinType *BT = getAs()) { switch (BT->getKind()) { case BuiltinType::SveInt8: @@ -2460,7 +2460,7 @@ bool Type::isVLSTBuiltinType() const { } QualType Type::getSveEltType(const ASTContext &Ctx) const { - assert(isVLSTBuiltinType() && "unsupported type!"); + assert(isSveVLSBuiltinType() && "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 index 020b831f0c7bb..6d5a61b24133e 100644 --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/lib/CodeGen/CGExprScalar.cpp @@ -1798,7 +1798,7 @@ Value *ScalarExprEmitter::VisitArraySubscriptExpr(ArraySubscriptExpr *E) { // 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()->isSveVLSBuiltinType()) return EmitLoadOfLValue(E); // Handle the vector case. The base must be a vector, the index must be an @@ -4858,7 +4858,7 @@ VisitAbstractConditionalOperator(const AbstractConditionalOperator *E) { } if (condExpr->getType()->isVectorType() || - condExpr->getType()->isVLSTBuiltinType()) { + condExpr->getType()->isSveVLSBuiltinType()) { CGF.incrementProfileCounter(E); llvm::Value *CondV = CGF.EmitScalarExpr(condExpr); diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 8c3abc29315e7..dc5c47e3d7964 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -14827,7 +14827,7 @@ static void CheckImplicitConversion(Sema &S, Expr *E, QualType T, // Strip vector types. if (isa(Source)) { - if (Target->isVLSTBuiltinType() && + if (Target->isSveVLSBuiltinType() && (S.Context.areCompatibleSveTypes(QualType(Target, 0), QualType(Source, 0)) || S.Context.areLaxCompatibleSveTypes(QualType(Target, 0), @@ -14878,7 +14878,7 @@ static void CheckImplicitConversion(Sema &S, Expr *E, QualType T, const BuiltinType *TargetBT = dyn_cast(Target); // Strip SVE vector types - if (SourceBT && SourceBT->isVLSTBuiltinType()) { + if (SourceBT && SourceBT->isSveVLSBuiltinType()) { // 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 @@ static void CheckImplicitConversion(Sema &S, Expr *E, QualType T, Source = SourceBT->getSveEltType(S.Context).getTypePtr(); } - if (TargetBT && TargetBT->isVLSTBuiltinType()) + if (TargetBT && TargetBT->isSveVLSBuiltinType()) 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 index 72e3b01cfea04..2848f1d4f9690 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -5945,7 +5945,7 @@ Sema::CreateBuiltinArraySubscriptExpr(Expr *Base, SourceLocation LLoc, if (Combined != MemberQuals) ResultType = Context.getQualifiedType(ResultType, Combined); } else if (LHSTy->isBuiltinType() && - LHSTy->getAs()->isVLSTBuiltinType()) { + LHSTy->getAs()->isSveVLSBuiltinType()) { const BuiltinType *BTy = LHSTy->getAs(); if (BTy->isSVEBool()) return ExprError(Diag(LLoc, diag::err_subscript_svbool_t) @@ -10934,7 +10934,7 @@ static bool tryGCCVectorConvertAndSplat(Sema &S, ExprResult *Scalar, assert(!isa(VT) && "ExtVectorTypes should not be handled here!"); VectorEltTy = VT->getElementType(); - } else if (VectorTy->isVLSTBuiltinType()) { + } else if (VectorTy->isSveVLSBuiltinType()) { VectorEltTy = VectorTy->castAs()->getSveEltType(S.getASTContext()); } else { @@ -11297,25 +11297,25 @@ QualType Sema::CheckSizelessVectorOperands(ExprResult &LHS, ExprResult &RHS, if (Context.hasSameType(LHSType, RHSType)) return LHSType; - if (LHSType->isVLSTBuiltinType() && !RHSType->isVLSTBuiltinType()) { + if (LHSType->isSveVLSBuiltinType() && !RHSType->isSveVLSBuiltinType()) { if (!tryGCCVectorConvertAndSplat(*this, &RHS, &LHS)) return LHSType; } - if (RHSType->isVLSTBuiltinType() && !LHSType->isVLSTBuiltinType()) { + if (RHSType->isSveVLSBuiltinType() && !LHSType->isSveVLSBuiltinType()) { if (LHS.get()->isLValue() || !tryGCCVectorConvertAndSplat(*this, &LHS, &RHS)) return RHSType; } - if ((!LHSType->isVLSTBuiltinType() && !LHSType->isRealType()) || - (!RHSType->isVLSTBuiltinType() && !RHSType->isRealType())) { + if ((!LHSType->isSveVLSBuiltinType() && !LHSType->isRealType()) || + (!RHSType->isSveVLSBuiltinType() && !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->isSveVLSBuiltinType() && RHSType->isSveVLSBuiltinType() && Context.getBuiltinVectorTypeInfo(LHSBuiltinTy).EC != Context.getBuiltinVectorTypeInfo(RHSBuiltinTy).EC) { Diag(Loc, diag::err_typecheck_vector_lengths_not_equal) @@ -11324,11 +11324,11 @@ QualType Sema::CheckSizelessVectorOperands(ExprResult &LHS, ExprResult &RHS, return QualType(); } - if (LHSType->isVLSTBuiltinType() || RHSType->isVLSTBuiltinType()) { - QualType Scalar = LHSType->isVLSTBuiltinType() ? RHSType : LHSType; - QualType Vector = LHSType->isVLSTBuiltinType() ? LHSType : RHSType; + if (LHSType->isSveVLSBuiltinType() || RHSType->isSveVLSBuiltinType()) { + QualType Scalar = LHSType->isSveVLSBuiltinType() ? RHSType : LHSType; + QualType Vector = LHSType->isSveVLSBuiltinType() ? LHSType : RHSType; bool ScalarOrVector = - LHSType->isVLSTBuiltinType() && RHSType->isVLSTBuiltinType(); + LHSType->isSveVLSBuiltinType() && RHSType->isSveVLSBuiltinType(); Diag(Loc, diag::err_typecheck_vector_not_convertable_implict_truncation) << ScalarOrVector << Scalar << Vector; @@ -11454,7 +11454,7 @@ QualType Sema::CheckMultiplyDivideOperands(ExprResult &LHS, ExprResult &RHS, /*AllowBoolConversions*/ false, /*AllowBooleanOperation*/ false, /*ReportInvalid*/ true); - if (LHSTy->isVLSTBuiltinType() || RHSTy->isVLSTBuiltinType()) + if (LHSTy->isSveVLSBuiltinType() || RHSTy->isSveVLSBuiltinType()) return CheckSizelessVectorOperands(LHS, RHS, Loc, IsCompAssign, ACK_Arithmetic); if (!IsDiv && @@ -11496,8 +11496,8 @@ QualType Sema::CheckRemainderOperands( return InvalidOperands(Loc, LHS, RHS); } - if (LHS.get()->getType()->isVLSTBuiltinType() || - RHS.get()->getType()->isVLSTBuiltinType()) { + if (LHS.get()->getType()->isSveVLSBuiltinType() || + RHS.get()->getType()->isSveVLSBuiltinType()) { if (LHS.get()->getType()->hasIntegerRepresentation() && RHS.get()->getType()->hasIntegerRepresentation()) return CheckSizelessVectorOperands(LHS, RHS, Loc, IsCompAssign, @@ -11815,8 +11815,8 @@ QualType Sema::CheckAdditionOperands(ExprResult &LHS, ExprResult &RHS, return compType; } - if (LHS.get()->getType()->isVLSTBuiltinType() || - RHS.get()->getType()->isVLSTBuiltinType()) { + if (LHS.get()->getType()->isSveVLSBuiltinType() || + RHS.get()->getType()->isSveVLSBuiltinType()) { QualType compType = CheckSizelessVectorOperands(LHS, RHS, Loc, CompLHSTy, ACK_Arithmetic); if (CompLHSTy) @@ -11930,8 +11930,8 @@ QualType Sema::CheckSubtractionOperands(ExprResult &LHS, ExprResult &RHS, return compType; } - if (LHS.get()->getType()->isVLSTBuiltinType() || - RHS.get()->getType()->isVLSTBuiltinType()) { + if (LHS.get()->getType()->isSveVLSBuiltinType() || + RHS.get()->getType()->isSveVLSBuiltinType()) { QualType compType = CheckSizelessVectorOperands(LHS, RHS, Loc, CompLHSTy, ACK_Arithmetic); if (CompLHSTy) @@ -12270,14 +12270,14 @@ static QualType checkSizelessVectorShift(Sema &S, ExprResult &LHS, QualType LHSType = LHS.get()->getType(); const BuiltinType *LHSBuiltinTy = LHSType->castAs(); - QualType LHSEleType = LHSType->isVLSTBuiltinType() + QualType LHSEleType = LHSType->isSveVLSBuiltinType() ? 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->isSveVLSBuiltinType() ? RHSBuiltinTy->getSveEltType(S.getASTContext()) : RHSType; @@ -12300,7 +12300,7 @@ static QualType checkSizelessVectorShift(Sema &S, ExprResult &LHS, return QualType(); } - if (LHSType->isVLSTBuiltinType() && RHSType->isVLSTBuiltinType() && + if (LHSType->isSveVLSBuiltinType() && RHSType->isSveVLSBuiltinType() && (S.Context.getBuiltinVectorTypeInfo(LHSBuiltinTy).EC != S.Context.getBuiltinVectorTypeInfo(RHSBuiltinTy).EC)) { S.Diag(Loc, diag::err_typecheck_invalid_operands) @@ -12309,8 +12309,8 @@ static QualType checkSizelessVectorShift(Sema &S, ExprResult &LHS, return QualType(); } - if (!LHSType->isVLSTBuiltinType()) { - assert(RHSType->isVLSTBuiltinType()); + if (!LHSType->isSveVLSBuiltinType()) { + assert(RHSType->isSveVLSBuiltinType()); if (IsCompAssign) return RHSType; if (LHSEleType != RHSEleType) { @@ -12323,7 +12323,7 @@ static QualType checkSizelessVectorShift(Sema &S, ExprResult &LHS, 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->isSveVLSBuiltinType()) { if (S.Context.getTypeSize(RHSBuiltinTy) != S.Context.getTypeSize(LHSBuiltinTy)) { S.Diag(Loc, diag::err_typecheck_vector_lengths_not_equal) @@ -12369,8 +12369,8 @@ QualType Sema::CheckShiftOperands(ExprResult &LHS, ExprResult &RHS, return checkVectorShift(*this, LHS, RHS, Loc, IsCompAssign); } - if (LHS.get()->getType()->isVLSTBuiltinType() || - RHS.get()->getType()->isVLSTBuiltinType()) + if (LHS.get()->getType()->isSveVLSBuiltinType() || + RHS.get()->getType()->isSveVLSBuiltinType()) return checkSizelessVectorShift(*this, LHS, RHS, Loc, IsCompAssign); // Shifts don't perform usual arithmetic conversions, they just do integer @@ -13059,8 +13059,8 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS, RHS.get()->getType()->isVectorType()) return CheckVectorCompareOperands(LHS, RHS, Loc, Opc); - if (LHS.get()->getType()->isVLSTBuiltinType() || - RHS.get()->getType()->isVLSTBuiltinType()) + if (LHS.get()->getType()->isSveVLSBuiltinType() || + RHS.get()->getType()->isSveVLSBuiltinType()) return CheckSizelessVectorCompareOperands(LHS, RHS, Loc, Opc); diagnoseLogicalNotOnLHSofCheck(*this, LHS, RHS, Loc, Opc); @@ -13935,8 +13935,8 @@ inline QualType Sema::CheckBitwiseOperands(ExprResult &LHS, ExprResult &RHS, return InvalidOperands(Loc, LHS, RHS); } - if (LHS.get()->getType()->isVLSTBuiltinType() || - RHS.get()->getType()->isVLSTBuiltinType()) { + if (LHS.get()->getType()->isSveVLSBuiltinType() || + RHS.get()->getType()->isSveVLSBuiltinType()) { if (LHS.get()->getType()->hasIntegerRepresentation() && RHS.get()->getType()->hasIntegerRepresentation()) return CheckSizelessVectorOperands(LHS, RHS, Loc, IsCompAssign, @@ -13944,8 +13944,8 @@ inline QualType Sema::CheckBitwiseOperands(ExprResult &LHS, ExprResult &RHS, return InvalidOperands(Loc, LHS, RHS); } - if (LHS.get()->getType()->isVLSTBuiltinType() || - RHS.get()->getType()->isVLSTBuiltinType()) { + if (LHS.get()->getType()->isSveVLSBuiltinType() || + RHS.get()->getType()->isSveVLSBuiltinType()) { if (LHS.get()->getType()->hasIntegerRepresentation() && RHS.get()->getType()->hasIntegerRepresentation()) return CheckSizelessVectorOperands(LHS, RHS, Loc, IsCompAssign, @@ -16309,7 +16309,7 @@ ExprResult Sema::CreateBuiltinUnaryOp(SourceLocation OpLoc, resultType->castAs()->getVectorKind() != VectorType::AltiVecBool)) break; - else if (resultType->isVLSTBuiltinType()) // SVE vectors allow + and - + else if (resultType->isSveVLSBuiltinType()) // 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 index e6eb9508f8e6f..dfb42799c67c1 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -6305,7 +6305,7 @@ static bool isValidVectorForConditionalCondition(ASTContext &Ctx, static bool isValidSizelessVectorForConditionalCondition(ASTContext &Ctx, QualType CondTy) { - if (!CondTy->isVLSTBuiltinType()) + if (!CondTy->isSveVLSBuiltinType()) return false; const QualType EltTy = cast(CondTy.getCanonicalType())->getSveEltType(Ctx); @@ -6417,10 +6417,10 @@ QualType Sema::CheckSizelessVectorConditionalTypes(ExprResult &Cond, QualType LHSType = LHS.get()->getType(); const auto *LHSBT = - LHSType->isVLSTBuiltinType() ? LHSType->getAs() : nullptr; + LHSType->isSveVLSBuiltinType() ? LHSType->getAs() : nullptr; QualType RHSType = RHS.get()->getType(); const auto *RHSBT = - RHSType->isVLSTBuiltinType() ? RHSType->getAs() : nullptr; + RHSType->isSveVLSBuiltinType() ? RHSType->getAs() : nullptr; QualType ResultType; @@ -6462,7 +6462,7 @@ QualType Sema::CheckSizelessVectorConditionalTypes(ExprResult &Cond, RHS = ImpCastExprToType(RHS.get(), ResultType, CK_VectorSplat); } - assert(!ResultType.isNull() && ResultType->isVLSTBuiltinType() && + assert(!ResultType.isNull() && ResultType->isSveVLSBuiltinType() && "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 index 623c2c50770a3..9ae287d6cf0ea 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -8363,7 +8363,7 @@ static void HandleArmSveVectorBitsTypeAttr(QualType &CurType, ParsedAttr &Attr, } // Attribute can only be attached to a single SVE vector or predicate type. - if (!CurType->isVLSTBuiltinType()) { + if (!CurType->isSveVLSBuiltinType()) { S.Diag(Attr.getLoc(), diag::err_attribute_invalid_sve_type) << Attr << CurType; Attr.setInvalid();