diff --git a/paddle/cinn/optim/ir_simplify.cc b/paddle/cinn/optim/ir_simplify.cc index 752a81a8a4bc11f82ba08d8e0ec0b70c2d995179..8856b144488b65c61b93ff79295a957af2fb5274 100644 --- a/paddle/cinn/optim/ir_simplify.cc +++ b/paddle/cinn/optim/ir_simplify.cc @@ -299,6 +299,9 @@ struct SimplifyBlocksMutator : public ir::IRMutator<> { *expr = node->stmts[0]; Visit(expr, expr); } else { + for (auto& s : node->stmts) { + Visit(&s, &s); + } std::vector stmts; for (auto& s : node->stmts) { if (s.As()) { @@ -308,7 +311,6 @@ struct SimplifyBlocksMutator : public ir::IRMutator<> { stmts.push_back(inner_stmt); } } else { - IRMutator<>::Visit(&s, &s); stmts.push_back(s); } }