Skip to content

Commit c28dfa1

Browse files
authored
[MLIR] Update Inliner.cpp to use LDBG() for logging (NFC) (#150762)
1 parent 789fcef commit c28dfa1

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

mlir/lib/Transforms/Utils/Inliner.cpp

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include "mlir/Transforms/InliningUtils.h"
2222
#include "llvm/ADT/SCCIterator.h"
2323
#include "llvm/ADT/STLExtras.h"
24-
#include "llvm/Support/Debug.h"
24+
#include "llvm/Support/DebugLog.h"
2525

2626
#define DEBUG_TYPE "inlining"
2727

@@ -614,10 +614,10 @@ Inliner::Impl::inlineCallsInSCC(InlinerInterfaceImpl &inlinerIface,
614614
std::vector<InlineHistoryT> callHistory(calls.size(), InlineHistoryT{});
615615

616616
LLVM_DEBUG({
617-
llvm::dbgs() << "* Inliner: Initial calls in SCC are: {\n";
617+
LDBG() << "* Inliner: Initial calls in SCC are: {";
618618
for (unsigned i = 0, e = calls.size(); i < e; ++i)
619-
llvm::dbgs() << " " << i << ". " << calls[i].call << ",\n";
620-
llvm::dbgs() << "}\n";
619+
LDBG() << " " << i << ". " << calls[i].call << ",";
620+
LDBG() << "}";
621621
});
622622

623623
// Try to inline each of the call operations. Don't cache the end iterator
@@ -635,9 +635,9 @@ Inliner::Impl::inlineCallsInSCC(InlinerInterfaceImpl &inlinerIface,
635635
CallOpInterface call = it.call;
636636
LLVM_DEBUG({
637637
if (doInline)
638-
llvm::dbgs() << "* Inlining call: " << i << ". " << call << "\n";
638+
LDBG() << "* Inlining call: " << i << ". " << call;
639639
else
640-
llvm::dbgs() << "* Not inlining call: " << i << ". " << call << "\n";
640+
LDBG() << "* Not inlining call: " << i << ". " << call;
641641
});
642642
if (!doInline)
643643
continue;
@@ -654,7 +654,7 @@ Inliner::Impl::inlineCallsInSCC(InlinerInterfaceImpl &inlinerIface,
654654
cast<CallableOpInterface>(targetRegion->getParentOp()),
655655
targetRegion, /*shouldCloneInlinedRegion=*/!inlineInPlace);
656656
if (failed(inlineResult)) {
657-
LLVM_DEBUG(llvm::dbgs() << "** Failed to inline\n");
657+
LDBG() << "** Failed to inline";
658658
continue;
659659
}
660660
inlinedAnyCalls = true;
@@ -667,19 +667,16 @@ Inliner::Impl::inlineCallsInSCC(InlinerInterfaceImpl &inlinerIface,
667667
auto historyToString = [](InlineHistoryT h) {
668668
return h.has_value() ? std::to_string(*h) : "root";
669669
};
670-
(void)historyToString;
671-
LLVM_DEBUG(llvm::dbgs()
672-
<< "* new inlineHistory entry: " << newInlineHistoryID << ". ["
673-
<< getNodeName(call) << ", " << historyToString(inlineHistoryID)
674-
<< "]\n");
670+
LDBG() << "* new inlineHistory entry: " << newInlineHistoryID << ". ["
671+
<< getNodeName(call) << ", " << historyToString(inlineHistoryID)
672+
<< "]";
675673

676674
for (unsigned k = prevSize; k != calls.size(); ++k) {
677675
callHistory.push_back(newInlineHistoryID);
678-
LLVM_DEBUG(llvm::dbgs() << "* new call " << k << " {" << calls[i].call
679-
<< "}\n with historyID = " << newInlineHistoryID
680-
<< ", added due to inlining of\n call {" << call
681-
<< "}\n with historyID = "
682-
<< historyToString(inlineHistoryID) << "\n");
676+
LDBG() << "* new call " << k << " {" << calls[k].call
677+
<< "}\n with historyID = " << newInlineHistoryID
678+
<< ", added due to inlining of\n call {" << call
679+
<< "}\n with historyID = " << historyToString(inlineHistoryID);
683680
}
684681

685682
// If the inlining was successful, Merge the new uses into the source node.

0 commit comments

Comments
 (0)