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

Craig Topper via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 8 17:08:11 PST 2023


https://github.com/topperc created https://github.com/llvm/llvm-project/pull/74906

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

>From 0067a9c7260591904578c3f6648bb925630dcfa7 Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Fri, 8 Dec 2023 17:06:36 -0800
Subject: [PATCH] [RISCV] Reduce the size of the index used for RVV intrinsics.
 NFC

Rather than using size_t, use unsigned. We don't have more than
4 billion intrinsics.
---
 clang/lib/Sema/SemaRISCVVectorLookup.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/clang/lib/Sema/SemaRISCVVectorLookup.cpp b/clang/lib/Sema/SemaRISCVVectorLookup.cpp
index 9a5aecf669a07..b7add334c7f37 100644
--- a/clang/lib/Sema/SemaRISCVVectorLookup.cpp
+++ b/clang/lib/Sema/SemaRISCVVectorLookup.cpp
@@ -49,7 +49,7 @@ struct RVVIntrinsicDef {
 
 struct RVVOverloadIntrinsicDef {
   // Indexes of RISCVIntrinsicManagerImpl::IntrinsicList.
-  SmallVector<size_t, 8> Indexes;
+  SmallVector<unsigned, 8> Indexes;
 };
 
 } // namespace
@@ -168,7 +168,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<unsigned> Intrinsics;
   // Mapping function name to RVVOverloadIntrinsicDef.
   StringMap<RVVOverloadIntrinsicDef> OverloadIntrinsics;
 
@@ -392,7 +392,7 @@ void RISCVIntrinsicManagerImpl::InitRVVIntrinsic(
                                      Record.HasFRMRoundModeOp);
 
   // Put into IntrinsicList.
-  size_t Index = IntrinsicList.size();
+  unsigned Index = IntrinsicList.size();
   IntrinsicList.push_back({Name, OverloadedName, BuiltinName, Signature});
 
   // Creating mapping to Intrinsics.



More information about the cfe-commits mailing list