[clang] 1bbf722 - [RISCV] Use getBuiltinVectorTypeInfo to simplify code. NFC

Craig Topper via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 11 11:59:11 PST 2023


Author: Craig Topper
Date: 2023-12-11T11:58:58-08:00
New Revision: 1bbf7225c1f0dde8c59c8acfc0b54999391df184

URL: https://github.com/llvm/llvm-project/commit/1bbf7225c1f0dde8c59c8acfc0b54999391df184
DIFF: https://github.com/llvm/llvm-project/commit/1bbf7225c1f0dde8c59c8acfc0b54999391df184.diff

LOG: [RISCV] Use getBuiltinVectorTypeInfo to simplify code. NFC

Added: 
    

Modified: 
    clang/lib/Sema/SemaChecking.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 5c97346184470..08c03d75ec3c8 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -5082,12 +5082,10 @@ static bool CheckInvalidVLENandLMUL(const TargetInfo &TI, CallExpr *TheCall,
   assert((EGW == 128 || EGW == 256) && "EGW can only be 128 or 256 bits");
 
   // LMUL * VLEN >= EGW
-  unsigned ElemSize = Type->isRVVType(32, false) ? 32 : 64;
-  unsigned MinElemCount = Type->isRVVType(1)   ? 1
-                          : Type->isRVVType(2) ? 2
-                          : Type->isRVVType(4) ? 4
-                          : Type->isRVVType(8) ? 8
-                                               : 16;
+  ASTContext::BuiltinVectorTypeInfo Info =
+      S.Context.getBuiltinVectorTypeInfo(Type->castAs<BuiltinType>());
+  unsigned ElemSize = S.Context.getTypeSize(Info.ElementType);
+  unsigned MinElemCount = Info.EC.getKnownMinValue();
 
   unsigned EGS = EGW / ElemSize;
   // If EGS is less than or equal to the minimum number of elements, then the


        


More information about the cfe-commits mailing list