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

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 28 06:00:53 PDT 2023


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

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

>From 847451fdf8c70b1deebdd4d4cf4ce3ce84845f5d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Thu, 28 Sep 2023 14:41:55 +0200
Subject: [PATCH] [clang][Sema] Only check RVV types is we have them

isRVVType() is suprisingly expensive, so do the checks only if the
target has rvv types.
---
 clang/lib/Sema/Sema.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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.



More information about the cfe-commits mailing list