diff --git a/mlir/include/mlir/IR/OpDefinition.h b/mlir/include/mlir/IR/OpDefinition.h --- a/mlir/include/mlir/IR/OpDefinition.h +++ b/mlir/include/mlir/IR/OpDefinition.h @@ -260,6 +260,12 @@ using PointerUnion::PointerUnion; }; +/// Allow printing to a stream. +inline raw_ostream &operator<<(raw_ostream &os, OpState &op) { + op.print(os, OpPrintingFlags().useLocalScope()); + return os; +} + /// This template defines the foldHook as used by AbstractOperation. /// /// The default implementation uses a general fold method that can be defined on diff --git a/mlir/lib/Transforms/Inliner.cpp b/mlir/lib/Transforms/Inliner.cpp --- a/mlir/lib/Transforms/Inliner.cpp +++ b/mlir/lib/Transforms/Inliner.cpp @@ -415,16 +415,15 @@ for (unsigned i = 0; i != calls.size(); ++i) { ResolvedCall it = calls[i]; bool doInline = shouldInline(it); + CallOpInterface call = it.call; LLVM_DEBUG({ if (doInline) - llvm::dbgs() << "* Inlining call: "; + llvm::dbgs() << "* Inlining call: " << call << "\n"; else - llvm::dbgs() << "* Not inlining call: "; - it.call.dump(); + llvm::dbgs() << "* Not inlining call: " << call << "\n"; }); if (!doInline) continue; - CallOpInterface call = it.call; Region *targetRegion = it.targetNode->getCallableRegion(); // If this is the last call to the target node and the node is discardable, @@ -434,8 +433,10 @@ LogicalResult inlineResult = inlineCall( inliner, call, cast(targetRegion->getParentOp()), targetRegion, /*shouldCloneInlinedRegion=*/!inlineInPlace); - if (failed(inlineResult)) + if (failed(inlineResult)) { + LLVM_DEBUG(llvm::dbgs() << "** Failed to inline: " << call << "\n"); continue; + } inlinedAnyCalls = true; // If the inlining was successful, Merge the new uses into the source node.