Skip to content

Commit 5f3a51b

Browse files
joker-ephkrishna2803
authored andcommitted
[MLIR] Migrate InlinerInterfaceImpl to the new LDBG() debug form (NFC) (llvm#150853)
1 parent 30c8184 commit 5f3a51b

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed

mlir/lib/Dialect/LLVMIR/Transforms/InlinerInterfaceImpl.cpp

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
#include "llvm/ADT/ScopeExit.h"
2323
#include "llvm/Support/Debug.h"
2424

25+
#include "llvm/Support/DebugLog.h"
26+
2527
#define DEBUG_TYPE "llvm-inliner"
2628

2729
using namespace mlir;
@@ -670,44 +672,42 @@ struct LLVMInlinerInterface : public DialectInlinerInterface {
670672
bool wouldBeCloned) const final {
671673
auto callOp = dyn_cast<LLVM::CallOp>(call);
672674
if (!callOp) {
673-
LLVM_DEBUG(llvm::dbgs() << "Cannot inline: call is not an '"
674-
<< LLVM::CallOp::getOperationName() << "' op\n");
675+
LDBG() << "Cannot inline: call is not an '"
676+
<< LLVM::CallOp::getOperationName() << "' op";
675677
return false;
676678
}
677679
if (callOp.getNoInline()) {
678-
LLVM_DEBUG(llvm::dbgs() << "Cannot inline: call is marked no_inline\n");
680+
LDBG() << "Cannot inline: call is marked no_inline";
679681
return false;
680682
}
681683
auto funcOp = dyn_cast<LLVM::LLVMFuncOp>(callable);
682684
if (!funcOp) {
683-
LLVM_DEBUG(llvm::dbgs()
684-
<< "Cannot inline: callable is not an '"
685-
<< LLVM::LLVMFuncOp::getOperationName() << "' op\n");
685+
LDBG() << "Cannot inline: callable is not an '"
686+
<< LLVM::LLVMFuncOp::getOperationName() << "' op";
686687
return false;
687688
}
688689
if (funcOp.isNoInline()) {
689-
LLVM_DEBUG(llvm::dbgs()
690-
<< "Cannot inline: function is marked no_inline\n");
690+
LDBG() << "Cannot inline: function is marked no_inline";
691691
return false;
692692
}
693693
if (funcOp.isVarArg()) {
694-
LLVM_DEBUG(llvm::dbgs() << "Cannot inline: callable is variadic\n");
694+
LDBG() << "Cannot inline: callable is variadic";
695695
return false;
696696
}
697697
// TODO: Generate aliasing metadata from noalias result attributes.
698698
if (auto attrs = funcOp.getArgAttrs()) {
699699
for (DictionaryAttr attrDict : attrs->getAsRange<DictionaryAttr>()) {
700700
if (attrDict.contains(LLVM::LLVMDialect::getInAllocaAttrName())) {
701-
LLVM_DEBUG(llvm::dbgs() << "Cannot inline " << funcOp.getSymName()
702-
<< ": inalloca arguments not supported\n");
701+
LDBG() << "Cannot inline " << funcOp.getSymName()
702+
<< ": inalloca arguments not supported";
703703
return false;
704704
}
705705
}
706706
}
707707
// TODO: Handle exceptions.
708708
if (funcOp.getPersonality()) {
709-
LLVM_DEBUG(llvm::dbgs() << "Cannot inline " << funcOp.getSymName()
710-
<< ": unhandled function personality\n");
709+
LDBG() << "Cannot inline " << funcOp.getSymName()
710+
<< ": unhandled function personality";
711711
return false;
712712
}
713713
if (funcOp.getPassthrough()) {
@@ -717,10 +717,8 @@ struct LLVMInlinerInterface : public DialectInlinerInterface {
717717
if (!stringAttr)
718718
return false;
719719
if (disallowedFunctionAttrs.contains(stringAttr)) {
720-
LLVM_DEBUG(llvm::dbgs()
721-
<< "Cannot inline " << funcOp.getSymName()
722-
<< ": found disallowed function attribute "
723-
<< stringAttr << "\n");
720+
LDBG() << "Cannot inline " << funcOp.getSymName()
721+
<< ": found disallowed function attribute " << stringAttr;
724722
return true;
725723
}
726724
return false;

0 commit comments

Comments
 (0)