[Mlir-commits] [mlir] [mlir][core] Restore dropped printIR behavior. (PR #196628)
Yi Zhang
llvmlistbot at llvm.org
Fri May 8 12:57:47 PDT 2026
https://github.com/cathyzhyi updated https://github.com/llvm/llvm-project/pull/196628
>From 879adedcc86617e37df6562a784bfc669cb096ac Mon Sep 17 00:00:00 2001
From: Yi Zhang <cathyzhyi at google.com>
Date: Fri, 8 May 2026 15:51:31 -0400
Subject: [PATCH] [mlir][core] Restore dropped printIR behavior.
Restore checking for module scope which is dropped in #195198
---
mlir/lib/Pass/IRPrinting.cpp | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/mlir/lib/Pass/IRPrinting.cpp b/mlir/lib/Pass/IRPrinting.cpp
index 032d4f7e2d67d..006ce3cbe794a 100644
--- a/mlir/lib/Pass/IRPrinting.cpp
+++ b/mlir/lib/Pass/IRPrinting.cpp
@@ -48,6 +48,11 @@ class IRPrinterInstrumentation : public PassInstrumentation {
static void printIR(Operation *op, bool printModuleScope, raw_ostream &out,
OpPrintingFlags flags) {
+ // Check to see if we are not printing at module scope.
+ if (!printModuleScope)
+ return op->print(out, op->getBlock() ? flags.useLocalScope() : flags);
+
+ // Otherwise, we are printing at module scope.
// Find the top-level operation.
auto *topLevelOp = op;
while (auto *parentOp = topLevelOp->getParentOp())
More information about the Mlir-commits
mailing list