[clang] 0523bf1 - [RISCV] Reduce the size of the index used for RVV intrinsics. NFC (#74906)

via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 12 17:40:58 PST 2023


Author: Craig Topper
Date: 2023-12-12T17:40:54-08:00
New Revision: 0523bf1eca4475edafc8aab830c2ce48b01900c3

URL: https://github.com/llvm/llvm-project/commit/0523bf1eca4475edafc8aab830c2ce48b01900c3
DIFF: https://github.com/llvm/llvm-project/commit/0523bf1eca4475edafc8aab830c2ce48b01900c3.diff

LOG: [RISCV] Reduce the size of the index used for RVV intrinsics. NFC (#74906)

Rather than using size_t, use uint32_t. We don't have more than 4
billion intrinsics.

Added: 
    

Modified: 
    clang/lib/Sema/SemaRISCVVectorLookup.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaRISCVVectorLookup.cpp b/clang/lib/Sema/SemaRISCVVectorLookup.cpp
index 0d411fca0f9c82..e4642e4da016a4 100644
--- a/clang/lib/Sema/SemaRISCVVectorLookup.cpp
+++ b/clang/lib/Sema/SemaRISCVVectorLookup.cpp
@@ -43,7 +43,7 @@ struct RVVIntrinsicDef {
 
 struct RVVOverloadIntrinsicDef {
   // Indexes of RISCVIntrinsicManagerImpl::IntrinsicList.
-  SmallVector<size_t, 8> Indexes;
+  SmallVector<uint32_t, 8> Indexes;
 };
 
 } // namespace
@@ -162,7 +162,7 @@ class RISCVIntrinsicManagerImpl : public sema::RISCVIntrinsicManager {
   // List of all RVV intrinsic.
   std::vector<RVVIntrinsicDef> IntrinsicList;
   // Mapping function name to index of IntrinsicList.
-  StringMap<size_t> Intrinsics;
+  StringMap<uint32_t> Intrinsics;
   // Mapping function name to RVVOverloadIntrinsicDef.
   StringMap<RVVOverloadIntrinsicDef> OverloadIntrinsics;
 
@@ -174,7 +174,7 @@ class RISCVIntrinsicManagerImpl : public sema::RISCVIntrinsicManager {
 
   // Create FunctionDecl for a vector intrinsic.
   void CreateRVVIntrinsicDecl(LookupResult &LR, IdentifierInfo *II,
-                              Preprocessor &PP, unsigned Index,
+                              Preprocessor &PP, uint32_t Index,
                               bool IsOverload);
 
   void ConstructRVVIntrinsics(ArrayRef<RVVIntrinsicRecord> Recs,
@@ -386,7 +386,7 @@ void RISCVIntrinsicManagerImpl::InitRVVIntrinsic(
                                      Record.HasFRMRoundModeOp);
 
   // Put into IntrinsicList.
-  size_t Index = IntrinsicList.size();
+  uint32_t Index = IntrinsicList.size();
   IntrinsicList.push_back({BuiltinName, Signature});
 
   // Creating mapping to Intrinsics.
@@ -403,7 +403,7 @@ void RISCVIntrinsicManagerImpl::InitRVVIntrinsic(
 void RISCVIntrinsicManagerImpl::CreateRVVIntrinsicDecl(LookupResult &LR,
                                                        IdentifierInfo *II,
                                                        Preprocessor &PP,
-                                                       unsigned Index,
+                                                       uint32_t Index,
                                                        bool IsOverload) {
   ASTContext &Context = S.Context;
   RVVIntrinsicDef &IDef = IntrinsicList[Index];


        


More information about the cfe-commits mailing list