From 62b29d9f76414e127d34e679151a239637071d87 Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Thu, 21 Aug 2025 00:45:39 +0200 Subject: [PATCH] [MLIR] Adopt LDBG() debug macro in BytecodeWriter.cpp (NFC) (#154642) --- mlir/lib/Bytecode/Writer/BytecodeWriter.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/mlir/lib/Bytecode/Writer/BytecodeWriter.cpp b/mlir/lib/Bytecode/Writer/BytecodeWriter.cpp index 6ebeac5ae69f..eacb936c763b 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 @@ -150,8 +151,7 @@ public: /// 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 @@ public: /// 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 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 @@ public: /// Emit a single byte. template 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(byte)); } /// Emit a range of bytes. void emitBytes(ArrayRef 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 @@ public: /// 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.