[llvm] [NFC][TableGen] Code cleanup in CodeGenTarget.cpp (PR #125569)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 3 14:50:40 PST 2025


================
@@ -324,9 +325,8 @@ void CodeGenTarget::ComputeInstrsByEnum() const {
       });
 
   // Assign an enum value to each instruction according to the sorted order.
-  unsigned Num = 0;
-  for (const CodeGenInstruction *Inst : InstrsByEnum)
-    Inst->EnumVal = Num++;
+  for (const auto &[Idx, Inst] : enumerate(InstrsByEnum))
+    const_cast<CodeGenInstruction *>(Inst)->EnumVal = Idx;
----------------
jurahul wrote:

Done.

https://github.com/llvm/llvm-project/pull/125569


More information about the llvm-commits mailing list