diff --git a/paddle/ir/core/ir_printer.cc b/paddle/ir/core/ir_printer.cc index f17fc0125556966472d8f57e0edad211d3ec92ae..b72081fd0a4315097d0316a2a90b23d92d5a6ac4 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 1692195cb8b69cc5a5fa4f400e28fdecf28e47b5..e60e8fa5cfd4df0ec8ce70f8732e9bfc916a8aa7 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;