[Mlir-commits] [mlir] [mlir] Fix debug output for passes that modify top-level operation. (PR #80022)

Matthias Springer llvmlistbot at llvm.org
Wed Jan 31 00:13:08 PST 2024


================
@@ -40,7 +40,9 @@ static void logImpossibleToMatch(const Pattern &pattern) {
 
 /// Log IR after pattern application.
 static Operation *getDumpRootOp(Operation *op) {
-  return op->getParentWithTrait<mlir::OpTrait::IsIsolatedFromAbove>();
+  return op->hasTrait<mlir::OpTrait::IsIsolatedFromAbove>()
+             ? op
+             : op->getParentWithTrait<mlir::OpTrait::IsIsolatedFromAbove>();
----------------
matthias-springer wrote:

This change makes sense to me. If there is no isolated-from-above parent, we are modifying the top-level module and we should dump it directly.

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


More information about the Mlir-commits mailing list