[clang] [Clang][RISCV] Remove duplicate functions isRVVSizelessBuiltinType. NFC (PR #67089)

2024-05-03 Thread via cfe-commits

cor3ntin wrote:

Closing that as an alternative solution was committed

https://github.com/llvm/llvm-project/pull/67089
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang][RISCV] Remove duplicate functions isRVVSizelessBuiltinType. NFC (PR #67089)

2024-05-03 Thread via cfe-commits

https://github.com/cor3ntin closed 
https://github.com/llvm/llvm-project/pull/67089
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang][RISCV] Remove duplicate functions isRVVSizelessBuiltinType. NFC (PR #67089)

2023-12-08 Thread Craig Topper via cfe-commits

topperc wrote:

> Can we reverse this patch? Keep isRVVSizelessBuiltinType and remove 
> isRVVType. The implementation of isRVVSizelessBuiltinType is more efficient 
> according to some profiling. At least on Release+Asserts build

I went ahead and committed that change.

https://github.com/llvm/llvm-project/pull/67089
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang][RISCV] Remove duplicate functions isRVVSizelessBuiltinType. NFC (PR #67089)

2023-12-08 Thread Craig Topper via cfe-commits

topperc wrote:

Can we reverse this patch? Keep isRVVSizelessBuiltinType and remove isRVVType. 
The implementation of isRVVSizelessBuiltinType is more efficient according to 
some profiling. At least on Release+Asserts build

https://github.com/llvm/llvm-project/pull/67089
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang][RISCV] Remove duplicate functions isRVVSizelessBuiltinType. NFC (PR #67089)

2023-11-15 Thread Craig Topper via cfe-commits

https://github.com/topperc approved this pull request.

LGTM

https://github.com/llvm/llvm-project/pull/67089
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang][RISCV] Remove duplicate functions isRVVSizelessBuiltinType. NFC (PR #67089)

2023-11-15 Thread Yueh-Ting Chen via cfe-commits

https://github.com/eopXD updated https://github.com/llvm/llvm-project/pull/67089

>From 0c449af2049f32103a4f7edf5852f317f6454a23 Mon Sep 17 00:00:00 2001
From: eopXD 
Date: Thu, 21 Sep 2023 23:17:22 -0700
Subject: [PATCH] [Clang][RISCV] Remove duplicate functions
 isRVVSizelessBuiltinType. NFC

`isRVVSizelessBuiltinType` and `isRVVType` has the same functionality.
This commit removes the former since we have more variants available in
`isRVVType`.
---
 clang/include/clang/AST/Type.h  |  3 ---
 clang/lib/AST/ASTContext.cpp| 14 ++
 clang/lib/AST/Type.cpp  | 15 +--
 clang/lib/Sema/SemaExpr.cpp |  8 
 clang/lib/Sema/SemaOverload.cpp |  3 +--
 5 files changed, 12 insertions(+), 31 deletions(-)

diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index 6c147eb8f640623..4c1f5dfc35f6a7e 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -2117,9 +2117,6 @@ class alignas(TypeAlignment) Type : public 
ExtQualsTypeCommonBase {
   /// Returns true for SVE scalable vector types.
   bool isSVESizelessBuiltinType() const;
 
-  /// Returns true for RVV scalable vector types.
-  bool isRVVSizelessBuiltinType() const;
-
   /// Check if this is a WebAssembly Externref Type.
   bool isWebAssemblyExternrefType() const;
 
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 4f54791b4c1e5ce..67e26204fa41f23 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -9521,10 +9521,9 @@ static uint64_t getRVVTypeSize(ASTContext , 
const BuiltinType *Ty) {
 
 bool ASTContext::areCompatibleRVVTypes(QualType FirstType,
QualType SecondType) {
-  assert(
-  ((FirstType->isRVVSizelessBuiltinType() && SecondType->isVectorType()) ||
-   (FirstType->isVectorType() && SecondType->isRVVSizelessBuiltinType())) 
&&
-  "Expected RVV builtin type and vector type!");
+  assert(((FirstType->isRVVType() && SecondType->isVectorType()) ||
+  (FirstType->isVectorType() && SecondType->isRVVType())) &&
+ "Expected RVV builtin type and vector type!");
 
   auto IsValidCast = [this](QualType FirstType, QualType SecondType) {
 if (const auto *BT = FirstType->getAs()) {
@@ -9546,10 +9545,9 @@ bool ASTContext::areCompatibleRVVTypes(QualType 
FirstType,
 
 bool ASTContext::areLaxCompatibleRVVTypes(QualType FirstType,
   QualType SecondType) {
-  assert(
-  ((FirstType->isRVVSizelessBuiltinType() && SecondType->isVectorType()) ||
-   (FirstType->isVectorType() && SecondType->isRVVSizelessBuiltinType())) 
&&
-  "Expected RVV builtin type and vector type!");
+  assert(((FirstType->isRVVType() && SecondType->isVectorType()) ||
+  (FirstType->isVectorType() && SecondType->isRVVType())) &&
+ "Expected RVV builtin type and vector type!");
 
   auto IsLaxCompatible = [this](QualType FirstType, QualType SecondType) {
 const auto *BT = FirstType->getAs();
diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp
index c8e452e2feab0bf..5e1ceafb80f3892 100644
--- a/clang/lib/AST/Type.cpp
+++ b/clang/lib/AST/Type.cpp
@@ -2403,7 +2403,7 @@ bool Type::isWebAssemblyTableType() const {
 bool Type::isSizelessType() const { return isSizelessBuiltinType(); }
 
 bool Type::isSizelessVectorType() const {
-  return isSVESizelessBuiltinType() || isRVVSizelessBuiltinType();
+  return isSVESizelessBuiltinType() || isRVVType();
 }
 
 bool Type::isSVESizelessBuiltinType() const {
@@ -2420,19 +2420,6 @@ bool Type::isSVESizelessBuiltinType() const {
   return false;
 }
 
-bool Type::isRVVSizelessBuiltinType() const {
-  if (const BuiltinType *BT = getAs()) {
-switch (BT->getKind()) {
-#define RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
-#include "clang/Basic/RISCVVTypes.def"
-  return true;
-default:
-  return false;
-}
-  }
-  return false;
-}
-
 bool Type::isSveVLSBuiltinType() const {
   if (const BuiltinType *BT = getAs()) {
 switch (BT->getKind()) {
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index fc39d6149c1cc65..b58a7c1989c1add 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -8272,7 +8272,7 @@ bool Sema::isValidRVVBitcast(QualType srcTy, QualType 
destTy) {
   assert(srcTy->isVectorType() || destTy->isVectorType());
 
   auto ValidScalableConversion = [](QualType FirstType, QualType SecondType) {
-if (!FirstType->isRVVSizelessBuiltinType())
+if (!FirstType->isRVVType())
   return false;
 
 const auto *VecTy = SecondType->getAs();
@@ -10254,8 +10254,8 @@ Sema::CheckAssignmentConstraints(QualType LHSType, 
ExprResult ,
   }
 
 // Allow assignments between fixed-length and sizeless RVV vectors.
-if ((LHSType->isRVVSizelessBuiltinType() && RHSType->isVectorType()) ||
-(LHSType->isVectorType() && RHSType->isRVVSizelessBuiltinType())) {
+if ((LHSType->isRVVType() 

[clang] [Clang][RISCV] Remove duplicate functions isRVVSizelessBuiltinType. NFC (PR #67089)

2023-11-15 Thread Yueh-Ting Chen via cfe-commits

eopXD wrote:

Ping.

https://github.com/llvm/llvm-project/pull/67089
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang][RISCV] Remove duplicate functions isRVVSizelessBuiltinType. NFC (PR #67089)

2023-10-01 Thread Yueh-Ting Chen via cfe-commits

eopXD wrote:

Ping.

https://github.com/llvm/llvm-project/pull/67089
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang][RISCV] Remove duplicate functions isRVVSizelessBuiltinType. NFC (PR #67089)

2023-09-22 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang


Changes

`isRVVSizelessBuiltinType` and `isRVVType` has the same functionality. This 
commit removes the former since we have more variants available in `isRVVType`.

---
Full diff: https://github.com/llvm/llvm-project/pull/67089.diff


5 Files Affected:

- (modified) clang/include/clang/AST/Type.h (-3) 
- (modified) clang/lib/AST/ASTContext.cpp (+6-8) 
- (modified) clang/lib/AST/Type.cpp (+1-14) 
- (modified) clang/lib/Sema/SemaExpr.cpp (+4-4) 
- (modified) clang/lib/Sema/SemaOverload.cpp (+1-2) 


``diff
diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index 4799f89db82fa7f..f4eb57e19d9370d 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -2061,9 +2061,6 @@ class alignas(8) Type : public ExtQualsTypeCommonBase {
   /// Returns true for SVE scalable vector types.
   bool isSVESizelessBuiltinType() const;
 
-  /// Returns true for RVV scalable vector types.
-  bool isRVVSizelessBuiltinType() const;
-
   /// Check if this is a WebAssembly Externref Type.
   bool isWebAssemblyExternrefType() const;
 
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 4b1d9e86797b778..c670624b21f14ec 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -9571,10 +9571,9 @@ static uint64_t getRVVTypeSize(ASTContext , 
const BuiltinType *Ty) {
 
 bool ASTContext::areCompatibleRVVTypes(QualType FirstType,
QualType SecondType) {
-  assert(
-  ((FirstType->isRVVSizelessBuiltinType() && SecondType->isVectorType()) ||
-   (FirstType->isVectorType() && SecondType->isRVVSizelessBuiltinType())) 
&&
-  "Expected RVV builtin type and vector type!");
+  assert(((FirstType->isRVVType() && SecondType->isVectorType()) ||
+  (FirstType->isVectorType() && SecondType->isRVVType())) &&
+ "Expected RVV builtin type and vector type!");
 
   auto IsValidCast = [this](QualType FirstType, QualType SecondType) {
 if (const auto *BT = FirstType->getAs()) {
@@ -9596,10 +9595,9 @@ bool ASTContext::areCompatibleRVVTypes(QualType 
FirstType,
 
 bool ASTContext::areLaxCompatibleRVVTypes(QualType FirstType,
   QualType SecondType) {
-  assert(
-  ((FirstType->isRVVSizelessBuiltinType() && SecondType->isVectorType()) ||
-   (FirstType->isVectorType() && SecondType->isRVVSizelessBuiltinType())) 
&&
-  "Expected RVV builtin type and vector type!");
+  assert(((FirstType->isRVVType() && SecondType->isVectorType()) ||
+  (FirstType->isVectorType() && SecondType->isRVVType())) &&
+ "Expected RVV builtin type and vector type!");
 
   auto IsLaxCompatible = [this](QualType FirstType, QualType SecondType) {
 const auto *BT = FirstType->getAs();
diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp
index c08ebfb7f142b35..d0be891122c8fc9 100644
--- a/clang/lib/AST/Type.cpp
+++ b/clang/lib/AST/Type.cpp
@@ -2372,7 +2372,7 @@ bool Type::isIncompleteType(NamedDecl **Def) const {
 }
 
 bool Type::isSizelessBuiltinType() const {
-  if (isSVESizelessBuiltinType() || isRVVSizelessBuiltinType())
+  if (isSVESizelessBuiltinType() || isRVVType())
 return true;
 
   if (const BuiltinType *BT = getAs()) {
@@ -2420,19 +2420,6 @@ bool Type::isSVESizelessBuiltinType() const {
   return false;
 }
 
-bool Type::isRVVSizelessBuiltinType() const {
-  if (const BuiltinType *BT = getAs()) {
-switch (BT->getKind()) {
-#define RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
-#include "clang/Basic/RISCVVTypes.def"
-  return true;
-default:
-  return false;
-}
-  }
-  return false;
-}
-
 bool Type::isSveVLSBuiltinType() const {
   if (const BuiltinType *BT = getAs()) {
 switch (BT->getKind()) {
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 92496b03ecabe54..dd1080a1085f07c 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -8223,7 +8223,7 @@ bool Sema::isValidRVVBitcast(QualType srcTy, QualType 
destTy) {
   assert(srcTy->isVectorType() || destTy->isVectorType());
 
   auto ValidScalableConversion = [](QualType FirstType, QualType SecondType) {
-if (!FirstType->isRVVSizelessBuiltinType())
+if (!FirstType->isRVVType())
   return false;
 
 const auto *VecTy = SecondType->getAs();
@@ -10212,8 +10212,8 @@ Sema::CheckAssignmentConstraints(QualType LHSType, 
ExprResult ,
   }
 
 // Allow assignments between fixed-length and sizeless RVV vectors.
-if ((LHSType->isRVVSizelessBuiltinType() && RHSType->isVectorType()) ||
-(LHSType->isVectorType() && RHSType->isRVVSizelessBuiltinType())) {
+if ((LHSType->isRVVType() && RHSType->isVectorType()) ||
+(LHSType->isVectorType() && RHSType->isRVVType())) {
   if (Context.areCompatibleRVVTypes(LHSType, RHSType) ||
   Context.areLaxCompatibleRVVTypes(LHSType, RHSType)) {
 Kind = 

[clang] [Clang][RISCV] Remove duplicate functions isRVVSizelessBuiltinType. NFC (PR #67089)

2023-09-22 Thread Yueh-Ting Chen via cfe-commits

https://github.com/eopXD created https://github.com/llvm/llvm-project/pull/67089

`isRVVSizelessBuiltinType` and `isRVVType` has the same functionality. This 
commit removes the former since we have more variants available in `isRVVType`.

>From 483240e16d800e52783dcfaf52eae81fb1dfca7c Mon Sep 17 00:00:00 2001
From: eopXD 
Date: Thu, 21 Sep 2023 23:17:22 -0700
Subject: [PATCH] [Clang][RISCV] Remove duplicate functions
 isRVVSizelessBuiltinType. NFC

`isRVVSizelessBuiltinType` and `isRVVType` has the same functionality.
This commit removes the former since we have more variants available in
`isRVVType`.
---
 clang/include/clang/AST/Type.h  |  3 ---
 clang/lib/AST/ASTContext.cpp| 14 ++
 clang/lib/AST/Type.cpp  | 15 +--
 clang/lib/Sema/SemaExpr.cpp |  8 
 clang/lib/Sema/SemaOverload.cpp |  3 +--
 5 files changed, 12 insertions(+), 31 deletions(-)

diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index 4799f89db82fa7f..f4eb57e19d9370d 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -2061,9 +2061,6 @@ class alignas(8) Type : public ExtQualsTypeCommonBase {
   /// Returns true for SVE scalable vector types.
   bool isSVESizelessBuiltinType() const;
 
-  /// Returns true for RVV scalable vector types.
-  bool isRVVSizelessBuiltinType() const;
-
   /// Check if this is a WebAssembly Externref Type.
   bool isWebAssemblyExternrefType() const;
 
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 4b1d9e86797b778..c670624b21f14ec 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -9571,10 +9571,9 @@ static uint64_t getRVVTypeSize(ASTContext , 
const BuiltinType *Ty) {
 
 bool ASTContext::areCompatibleRVVTypes(QualType FirstType,
QualType SecondType) {
-  assert(
-  ((FirstType->isRVVSizelessBuiltinType() && SecondType->isVectorType()) ||
-   (FirstType->isVectorType() && SecondType->isRVVSizelessBuiltinType())) 
&&
-  "Expected RVV builtin type and vector type!");
+  assert(((FirstType->isRVVType() && SecondType->isVectorType()) ||
+  (FirstType->isVectorType() && SecondType->isRVVType())) &&
+ "Expected RVV builtin type and vector type!");
 
   auto IsValidCast = [this](QualType FirstType, QualType SecondType) {
 if (const auto *BT = FirstType->getAs()) {
@@ -9596,10 +9595,9 @@ bool ASTContext::areCompatibleRVVTypes(QualType 
FirstType,
 
 bool ASTContext::areLaxCompatibleRVVTypes(QualType FirstType,
   QualType SecondType) {
-  assert(
-  ((FirstType->isRVVSizelessBuiltinType() && SecondType->isVectorType()) ||
-   (FirstType->isVectorType() && SecondType->isRVVSizelessBuiltinType())) 
&&
-  "Expected RVV builtin type and vector type!");
+  assert(((FirstType->isRVVType() && SecondType->isVectorType()) ||
+  (FirstType->isVectorType() && SecondType->isRVVType())) &&
+ "Expected RVV builtin type and vector type!");
 
   auto IsLaxCompatible = [this](QualType FirstType, QualType SecondType) {
 const auto *BT = FirstType->getAs();
diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp
index c08ebfb7f142b35..d0be891122c8fc9 100644
--- a/clang/lib/AST/Type.cpp
+++ b/clang/lib/AST/Type.cpp
@@ -2372,7 +2372,7 @@ bool Type::isIncompleteType(NamedDecl **Def) const {
 }
 
 bool Type::isSizelessBuiltinType() const {
-  if (isSVESizelessBuiltinType() || isRVVSizelessBuiltinType())
+  if (isSVESizelessBuiltinType() || isRVVType())
 return true;
 
   if (const BuiltinType *BT = getAs()) {
@@ -2420,19 +2420,6 @@ bool Type::isSVESizelessBuiltinType() const {
   return false;
 }
 
-bool Type::isRVVSizelessBuiltinType() const {
-  if (const BuiltinType *BT = getAs()) {
-switch (BT->getKind()) {
-#define RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
-#include "clang/Basic/RISCVVTypes.def"
-  return true;
-default:
-  return false;
-}
-  }
-  return false;
-}
-
 bool Type::isSveVLSBuiltinType() const {
   if (const BuiltinType *BT = getAs()) {
 switch (BT->getKind()) {
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 92496b03ecabe54..dd1080a1085f07c 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -8223,7 +8223,7 @@ bool Sema::isValidRVVBitcast(QualType srcTy, QualType 
destTy) {
   assert(srcTy->isVectorType() || destTy->isVectorType());
 
   auto ValidScalableConversion = [](QualType FirstType, QualType SecondType) {
-if (!FirstType->isRVVSizelessBuiltinType())
+if (!FirstType->isRVVType())
   return false;
 
 const auto *VecTy = SecondType->getAs();
@@ -10212,8 +10212,8 @@ Sema::CheckAssignmentConstraints(QualType LHSType, 
ExprResult ,
   }
 
 // Allow assignments between fixed-length and sizeless RVV vectors.
-if ((LHSType->isRVVSizelessBuiltinType() && RHSType->isVectorType()) ||
-