Skip to content

Conversation

@joker-eph
Copy link
Collaborator

No description provided.

@joker-eph joker-eph added the skip-precommit-approval PR for CI feedback, not intended for review label Aug 20, 2025
@joker-eph joker-eph enabled auto-merge (squash) August 20, 2025 22:37
@llvmbot llvmbot added mlir:core MLIR Core Infrastructure mlir labels Aug 20, 2025
@llvmbot
Copy link
Member

llvmbot commented Aug 20, 2025

@llvm/pr-subscribers-mlir

@llvm/pr-subscribers-mlir-core

Author: Mehdi Amini (joker-eph)

Changes

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

1 Files Affected:

  • (modified) mlir/lib/Bytecode/Writer/BytecodeWriter.cpp (+6-9)
diff --git a/mlir/lib/Bytecode/Writer/BytecodeWriter.cpp b/mlir/lib/Bytecode/Writer/BytecodeWriter.cpp
index 6ebeac5ae69f4..eacb936c763b7 100644
--- a/mlir/lib/Bytecode/Writer/BytecodeWriter.cpp
+++ b/mlir/lib/Bytecode/Writer/BytecodeWriter.cpp
@@ -19,6 +19,7 @@
 #include "llvm/ADT/MapVector.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/Support/Debug.h"
+#include "llvm/Support/DebugLog.h"
 #include "llvm/Support/Endian.h"
 #include "llvm/Support/raw_ostream.h"
 #include <optional>
@@ -150,8 +151,7 @@ class EncodingEmitter {
 
   /// Backpatch a byte in the result buffer at the given offset.
   void patchByte(uint64_t offset, uint8_t value, StringLiteral desc) {
-    LLVM_DEBUG(llvm::dbgs() << "patchByte(" << offset << ',' << uint64_t(value)
-                            << ")\t" << desc << '\n');
+    LDBG() << "patchByte(" << offset << ',' << uint64_t(value) << ")\t" << desc;
     assert(offset < size() && offset >= prevResultSize &&
            "cannot patch previously emitted data");
     currentResult[offset - prevResultSize] = value;
@@ -160,8 +160,7 @@ class EncodingEmitter {
   /// Emit the provided blob of data, which is owned by the caller and is
   /// guaranteed to not die before the end of the bytecode process.
   void emitOwnedBlob(ArrayRef<uint8_t> data, StringLiteral desc) {
-    LLVM_DEBUG(llvm::dbgs()
-               << "emitOwnedBlob(" << data.size() << "b)\t" << desc << '\n');
+    LDBG() << "emitOwnedBlob(" << data.size() << "b)\t" << desc;
     // Push the current buffer before adding the provided data.
     appendResult(std::move(currentResult));
     appendOwnedResult(data);
@@ -209,15 +208,13 @@ class EncodingEmitter {
   /// Emit a single byte.
   template <typename T>
   void emitByte(T byte, StringLiteral desc) {
-    LLVM_DEBUG(llvm::dbgs()
-               << "emitByte(" << uint64_t(byte) << ")\t" << desc << '\n');
+    LDBG() << "emitByte(" << uint64_t(byte) << ")\t" << desc;
     currentResult.push_back(static_cast<uint8_t>(byte));
   }
 
   /// Emit a range of bytes.
   void emitBytes(ArrayRef<uint8_t> bytes, StringLiteral desc) {
-    LLVM_DEBUG(llvm::dbgs()
-               << "emitBytes(" << bytes.size() << "b)\t" << desc << '\n');
+    LDBG() << "emitBytes(" << bytes.size() << "b)\t" << desc;
     llvm::append_range(currentResult, bytes);
   }
 
@@ -229,7 +226,7 @@ class EncodingEmitter {
   /// additional bytes, provide the value of the integer encoded in
   /// little-endian order.
   void emitVarInt(uint64_t value, StringLiteral desc) {
-    LLVM_DEBUG(llvm::dbgs() << "emitVarInt(" << value << ")\t" << desc << '\n');
+    LDBG() << "emitVarInt(" << value << ")\t" << desc;
 
     // In the most common case, the value can be represented in a single byte.
     // Given how hot this case is, explicitly handle that here.

@joker-eph joker-eph merged commit 62b29d9 into llvm:main Aug 20, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mlir:core MLIR Core Infrastructure mlir skip-precommit-approval PR for CI feedback, not intended for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants