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

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 14 06:25:28 PST 2026


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

>From 48d43fead71211677d1d692843e35bd81b10ffe2 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..b20312dbbb75b 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->convertInitializerToInt());
 
   // Saturate negative costs to the maximum
   if (CopyCostParsed < 0)



More information about the llvm-commits mailing list