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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Apr 19 05:12:19 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir-core

Author: Kunwar Grover (Groverkss)

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/89375.diff


1 Files Affected:

- (modified) mlir/lib/IR/AsmPrinter.cpp (+1-1) 


``````````diff
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 {

``````````

</details>


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


More information about the Mlir-commits mailing list