[llvm] [NFC][TableGen] Use convertKnownBitsToInt in CodeGenRegister (PR #180968)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 11 08:28:08 PST 2026


https://github.com/jurahul created https://github.com/llvm/llvm-project/pull/180968

None

>From d96f705b1b17beba9f78a9c46c3c7e23022dc364 Mon Sep 17 00:00:00 2001
From: Rahul Joshi <rjoshi at nvidia.com>
Date: Wed, 11 Feb 2026 08:26:21 -0800
Subject: [PATCH] [NFC][TableGen] Use convertKnownBitsToInt in CodeGenRegister

---
 llvm/utils/TableGen/Common/CodeGenRegisters.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/llvm/utils/TableGen/Common/CodeGenRegisters.cpp b/llvm/utils/TableGen/Common/CodeGenRegisters.cpp
index 9fcbc8d0ac97d..d9b0a55fd2966 100644
--- a/llvm/utils/TableGen/Common/CodeGenRegisters.cpp
+++ b/llvm/utils/TableGen/Common/CodeGenRegisters.cpp
@@ -755,8 +755,7 @@ CodeGenRegisterClass::CodeGenRegisterClass(CodeGenRegBank &RegBank,
   GlobalPriority = R->getValueAsBit("GlobalPriority");
 
   const BitsInit *TSF = R->getValueAsBitsInit("TSFlags");
-  for (auto [Idx, Bit] : enumerate(TSF->getBits()))
-    TSFlags |= uint8_t(cast<BitInit>(Bit)->getValue()) << Idx;
+  TSFlags = uint8_t(TSF->convertKnownBitsToInt());
 
   // Saturate negative costs to the maximum
   if (CopyCostParsed < 0)



More information about the llvm-commits mailing list