未验证 提交 edfc1ab8 编写于 作者: 傅剑寒 提交者: GitHub

rewrite SimplifyForLoop (#56350)

上级 b1573431
......@@ -182,6 +182,7 @@ std::shared_ptr<OpStrategy> StrategyForReduce(
// support the length-1 for loop yet. So we simplify here. The todo
// is that remove SimplifyForLoops below and change reduction schedule
optim::SimplifyForLoops(&temp);
optim::SimplifyBlocks(&temp);
vec_ast.emplace_back(temp);
} else if (arg_pack[i].is_tensor()) {
Expr temp = arg_pack[i];
......
......@@ -339,12 +339,9 @@ struct SimplifyForLoopsMutator : public ir::IRMutator<> {
std::string var_name = node->loop_var->name;
var_intervals.emplace(
var_name, common::CasInterval{min_i->value, extent_i->value - 1});
if (node->body.As<ir::Block>() &&
node->body.As<ir::Block>()->stmts.size() == 1) {
*expr = node->body.As<ir::Block>()->stmts[0];
} else {
*expr = node->body;
}
*expr = node->body;
Visit(expr, expr);
var_intervals.erase(var_name);
} else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册