[Mlir-commits] [mlir] [MLIR][AsmPrinter] Print aliases even when not at root operation (PR #89375)

Kunwar Grover llvmlistbot at llvm.org
Fri Apr 19 05:11:46 PDT 2024


https://github.com/Groverkss created https://github.com/llvm/llvm-project/pull/89375

This patch makes Operation::print print aliases even when not at the root operation. Aliases are still only printed if shouldUseLocalScope is specified in printing flags.

>From 70a5f938b23c0fbcfeaa3396cdcb48d21ca99a61 Mon Sep 17 00:00:00 2001
From: Kunwar Grover <groverkss at gmail.com>
Date: Fri, 19 Apr 2024 13:09:15 +0100
Subject: [PATCH] Print aliases even when not at root operation

---
 mlir/lib/IR/AsmPrinter.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mlir/lib/IR/AsmPrinter.cpp b/mlir/lib/IR/AsmPrinter.cpp
index e915b97d9ff17b..34bbdde005df7c 100644
--- a/mlir/lib/IR/AsmPrinter.cpp
+++ b/mlir/lib/IR/AsmPrinter.cpp
@@ -3920,7 +3920,7 @@ void Operation::print(raw_ostream &os, const OpPrintingFlags &printerFlags) {
 }
 void Operation::print(raw_ostream &os, AsmState &state) {
   OperationPrinter printer(os, state.getImpl());
-  if (!getParent() && !state.getPrinterFlags().shouldUseLocalScope()) {
+  if (!state.getPrinterFlags().shouldUseLocalScope()) {
     state.getImpl().initializeAliases(this);
     printer.printTopLevelOperation(this);
   } else {



More information about the Mlir-commits mailing list