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

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 19 08:03:19 PST 2025


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/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.


>From 2befdbd9b23c51c159456cc92062ee7e835050f4 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Wed, 19 Nov 2025 07:33:12 -0800
Subject: [PATCH] [TableGen] Use size_t for SubRegIndicesSize (NFC)

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.
---
 llvm/utils/TableGen/RegisterInfoEmitter.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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