Skip to content

Commit 485c515

Browse files
authored
fix_ir_printer (#54927)
* fix_ir_printer * Update ir_printer.cc
1 parent e200954 commit 485c515

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

paddle/ir/core/ir_printer.cc

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ void BasicIrPrinter::PrintType(Type type) {
7878
}
7979
}
8080

81-
void BasicIrPrinter::PrintAttribute(const Attribute& attr) {
81+
void BasicIrPrinter::PrintAttribute(Attribute attr) {
8282
if (!attr) {
8383
os << "<#AttrNull>";
8484
return;
@@ -119,15 +119,7 @@ void IrPrinter::PrintProgram(Program* program) {
119119
auto top_level_op = program->module_op();
120120
for (size_t i = 0; i < top_level_op->num_regions(); ++i) {
121121
auto& region = top_level_op->region(i);
122-
for (auto it = region.begin(); it != region.end(); ++it) {
123-
auto* block = *it;
124-
os << "{\n";
125-
for (auto it = block->begin(); it != block->end(); ++it) {
126-
PrintOperation(*it);
127-
os << newline;
128-
}
129-
os << "}\n";
130-
}
122+
PrintRegion(region);
131123
}
132124
}
133125

paddle/ir/core/ir_printer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class BasicIrPrinter {
3434

3535
void PrintType(Type type);
3636

37-
void PrintAttribute(const Attribute& attr);
37+
void PrintAttribute(Attribute attr);
3838

3939
public:
4040
std::ostream& os;

0 commit comments

Comments
 (0)