[Mlir-commits] [mlir] 34d0d6b - [mlir][DialectConversion] Print the operation being legalized if it has no regions
River Riddle
llvmlistbot at llvm.org
Tue Mar 17 21:06:48 PDT 2020
Author: River Riddle
Date: 2020-03-17T21:05:58-07:00
New Revision: 34d0d6ba74f84bcda4667b877e14a9e071015e54
URL: https://github.com/llvm/llvm-project/commit/34d0d6ba74f84bcda4667b877e14a9e071015e54
DIFF: https://github.com/llvm/llvm-project/commit/34d0d6ba74f84bcda4667b877e14a9e071015e54.diff
LOG: [mlir][DialectConversion] Print the operation being legalized if it has no regions
This helps when looking at the debug log and understanding what properties the invalid operation has when legalization fails.
Added:
Modified:
mlir/lib/Transforms/DialectConversion.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Transforms/DialectConversion.cpp b/mlir/lib/Transforms/DialectConversion.cpp
index 4b29d2edbe71..19304b3fb73f 100644
--- a/mlir/lib/Transforms/DialectConversion.cpp
+++ b/mlir/lib/Transforms/DialectConversion.cpp
@@ -1108,6 +1108,12 @@ OperationLegalizer::legalize(Operation *op,
os.startLine() << "Legalizing operation : '" << op->getName() << "'(" << op
<< ") {\n";
os.indent();
+
+ // If the operation has no regions, just print it here.
+ if (op->getNumRegions() == 0) {
+ op->print(os.startLine(), OpPrintingFlags().printGenericOpForm());
+ os.getOStream() << "\n\n";
+ }
});
// Check if this operation is legal on the target.
More information about the Mlir-commits
mailing list