[llvm] fc95558 - [TableGen] Use size_t for SubRegIndicesSize (NFC) (#168728)

via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 19 11:23:57 PST 2025


Author: Kazu Hirata
Date: 2025-11-19T11:23:53-08:00
New Revision: fc95558f628de4243dc85e31eaaac795435ca031

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

LOG: [TableGen] Use size_t for SubRegIndicesSize (NFC) (#168728)

This patch changes the type of SubRegIndicesSize to size_t.  The
original type deduced for "auto" is a signed type, but size_t, an
unsigned type, is safe here according to the usage.

Added: 
    

Modified: 
    llvm/utils/TableGen/RegisterInfoEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/RegisterInfoEmitter.cpp b/llvm/utils/TableGen/RegisterInfoEmitter.cpp
index e8c4a1a08e4ed..19eb32a9623dc 100644
--- a/llvm/utils/TableGen/RegisterInfoEmitter.cpp
+++ b/llvm/utils/TableGen/RegisterInfoEmitter.cpp
@@ -703,7 +703,7 @@ void RegisterInfoEmitter::emitComposeSubRegIndices(raw_ostream &OS,
   SmallVector<unsigned, 4> RowMap;
   SmallVector<SmallVector<const CodeGenSubRegIndex *, 4>, 4> Rows;
 
-  auto SubRegIndicesSize = llvm::size(SubRegIndices);
+  size_t SubRegIndicesSize = llvm::size(SubRegIndices);
   for (const auto &Idx : SubRegIndices) {
     unsigned Found = ~0u;
     for (unsigned r = 0, re = Rows.size(); r != re; ++r) {
@@ -1526,7 +1526,7 @@ void RegisterInfoEmitter::runTargetDesc(raw_ostream &OS, raw_ostream &MainOS,
 
   std::string ClassName = Target.getName().str() + "GenRegisterInfo";
 
-  auto SubRegIndicesSize = llvm::size(SubRegIndices);
+  size_t SubRegIndicesSize = llvm::size(SubRegIndices);
 
   if (!SubRegIndices.empty()) {
     emitComposeSubRegIndices(OS, ClassName);


        


More information about the llvm-commits mailing list