[llvm] [TableGen] Remove unnecessary use of utostr when writing to raw_ostream. NFC (PR #154800)

via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 21 10:31:41 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-tablegen

Author: Craig Topper (topperc)

<details>
<summary>Changes</summary>

raw_ostream is capable of printing unsigned or uint64_t directly.

---
Full diff: https://github.com/llvm/llvm-project/pull/154800.diff


1 Files Affected:

- (modified) llvm/utils/TableGen/CodeEmitterGen.cpp (+3-4) 


``````````diff
diff --git a/llvm/utils/TableGen/CodeEmitterGen.cpp b/llvm/utils/TableGen/CodeEmitterGen.cpp
index d7b5e21c3f1fb..a58fa9f79a8f0 100644
--- a/llvm/utils/TableGen/CodeEmitterGen.cpp
+++ b/llvm/utils/TableGen/CodeEmitterGen.cpp
@@ -154,9 +154,9 @@ bool CodeEmitterGen::addCodeToMergeInOperand(const Record *R,
     raw_string_ostream CaseOS(Case);
     CaseOS << indent(6);
     if (UseAPInt) {
-      CaseOS << EncoderMethodName << "(MI, " + utostr(OpIdx) << ", op";
+      CaseOS << EncoderMethodName << "(MI, " << OpIdx << ", op";
     } else {
-      CaseOS << "op = " << EncoderMethodName << "(MI, " << utostr(OpIdx);
+      CaseOS << "op = " << EncoderMethodName << "(MI, " << OpIdx;
     }
     CaseOS << ", Fixups, STI);\n";
   } else {
@@ -388,8 +388,7 @@ void CodeEmitterGen::addInstructionCasesForEncoding(
 
 static void emitInstBits(raw_ostream &OS, const APInt &Bits) {
   for (unsigned I = 0; I < Bits.getNumWords(); ++I)
-    OS << ((I > 0) ? ", " : "") << "UINT64_C(" << utostr(Bits.getRawData()[I])
-       << ")";
+    OS << ((I > 0) ? ", " : "") << "UINT64_C(" << Bits.getRawData()[I] << ")";
 }
 
 void CodeEmitterGen::emitInstructionBaseValues(

``````````

</details>


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


More information about the llvm-commits mailing list