Stmt Mutate_(const For* op, const Stmt& s) final {
Stmt stmt = IRMutator::Mutate_(op, s);
op = stmt.as<For>();
+ if (is_zero(op->extent)) {
+ return Evaluate::make(0);
+ }
return is_no_op(op->body) ? MakeEvaluate({op->min, op->extent}) : stmt;
}
Stmt Mutate_(const Allocate* op, const Stmt& s) final {
i + 1)
stmt2 = tvm.make.Block(stmt, store)
assert(tvm.ir_pass.RemoveNoOp(stmt2) == store)
-
+ # remove zero extent loop
+ stmt3 = tvm.make.For(i, 0, 0, 0, 0, store)
+ ret = tvm.ir_pass.RemoveNoOp(stmt3)
+ assert(isinstance(ret, tvm.stmt.Evaluate))
if __name__ == "__main__":
test_remove_no_op()