[Mlir-commits] [mlir] [mlir][Transforms] `GreedyPatternRewriteDriver`: log successful folding (PR #77796)

Matthias Springer llvmlistbot at llvm.org
Thu Jan 11 08:55:42 PST 2024


================
@@ -136,6 +136,17 @@ struct DebugFingerPrints : public RewriterBase::ForwardingListener {
 };
 #endif // MLIR_ENABLE_EXPENSIVE_PATTERN_API_CHECKS
 
+#ifndef NDEBUG
+static Operation *getDumpRootOp(Operation *op) {
+  return op->getParentWithTrait<mlir::OpTrait::IsIsolatedFromAbove>();
----------------
matthias-springer wrote:

I copied this from `PatternApplicator.cpp`, which prints the next isolated-from-above parent after each pattern application.

We could also just print the parent op. That would make it a bit harder to build a test case from the output of `-debug`. The next isolated-from-above op is often a function and at the moment you can just copy the entire output and put it into a `.mlir` file.


https://github.com/llvm/llvm-project/pull/77796


More information about the Mlir-commits mailing list