From 485c515d1075a2af17c2c208b6b6dadf09b95aee Mon Sep 17 00:00:00 2001 From: xingmingyyj <135400902+xingmingyyj@users.noreply.github.com> Date: Mon, 3 Jul 2023 14:20:26 +0800 Subject: [PATCH] fix_ir_printer (#54927) * fix_ir_printer * Update ir_printer.cc --- paddle/ir/core/ir_printer.cc | 12 ++---------- paddle/ir/core/ir_printer.h | 2 +- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/paddle/ir/core/ir_printer.cc b/paddle/ir/core/ir_printer.cc index f17fc012555..b72081fd0a4 100644 --- a/paddle/ir/core/ir_printer.cc +++ b/paddle/ir/core/ir_printer.cc @@ -78,7 +78,7 @@ void BasicIrPrinter::PrintType(Type type) { } } -void BasicIrPrinter::PrintAttribute(const Attribute& attr) { +void BasicIrPrinter::PrintAttribute(Attribute attr) { if (!attr) { os << "<#AttrNull>"; return; @@ -119,15 +119,7 @@ void IrPrinter::PrintProgram(Program* program) { auto top_level_op = program->module_op(); for (size_t i = 0; i < top_level_op->num_regions(); ++i) { auto& region = top_level_op->region(i); - for (auto it = region.begin(); it != region.end(); ++it) { - auto* block = *it; - os << "{\n"; - for (auto it = block->begin(); it != block->end(); ++it) { - PrintOperation(*it); - os << newline; - } - os << "}\n"; - } + PrintRegion(region); } } diff --git a/paddle/ir/core/ir_printer.h b/paddle/ir/core/ir_printer.h index 1692195cb8b..e60e8fa5cfd 100644 --- a/paddle/ir/core/ir_printer.h +++ b/paddle/ir/core/ir_printer.h @@ -34,7 +34,7 @@ class BasicIrPrinter { void PrintType(Type type); - void PrintAttribute(const Attribute& attr); + void PrintAttribute(Attribute attr); public: std::ostream& os; -- GitLab