[clang] [clang][Sema] Only check RVV types is we have them (PR #67669)

via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 28 06:02:05 PDT 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

<details>
<summary>Changes</summary>

isRVVType() is suprisingly expensive, so do the checks only if the target has rvv types.

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


1 Files Affected:

- (modified) clang/lib/Sema/Sema.cpp (+1-1) 


``````````diff
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
index a401017d4c1c0b8..2d175c9b9a791dd 100644
--- a/clang/lib/Sema/Sema.cpp
+++ b/clang/lib/Sema/Sema.cpp
@@ -2050,7 +2050,7 @@ void Sema::checkTypeSupport(QualType Ty, SourceLocation Loc, ValueDecl *D) {
         targetDiag(D->getLocation(), diag::note_defined_here, FD) << D;
     }
 
-    if (Ty->isRVVType())
+    if (TI.hasRISCVVTypes() && Ty->isRVVType())
       checkRVVTypeSupport(Ty, Loc, D);
 
     // Don't allow SVE types in functions without a SVE target.

``````````

</details>


https://github.com/llvm/llvm-project/pull/67669


More information about the cfe-commits mailing list