diff --git a/taichi/ir/basic_stmt_visitor.cpp b/taichi/ir/basic_stmt_visitor.cpp index e8d112d3bdc89..a52c019589094 100644 --- a/taichi/ir/basic_stmt_visitor.cpp +++ b/taichi/ir/basic_stmt_visitor.cpp @@ -8,12 +8,9 @@ BasicStmtVisitor::BasicStmtVisitor() { } void BasicStmtVisitor::visit(Block *stmt_list) { - auto backup_block = current_block; - current_block = stmt_list; for (auto &stmt : stmt_list->statements) { stmt->accept(this); } - current_block = backup_block; } void BasicStmtVisitor::visit(IfStmt *if_stmt) { diff --git a/taichi/ir/ir.cpp b/taichi/ir/ir.cpp index b4613ca630ee6..5f1c4c33daca6 100644 --- a/taichi/ir/ir.cpp +++ b/taichi/ir/ir.cpp @@ -565,8 +565,6 @@ IRNode *FrontendContext::root() { std::unique_ptr context; -Block *current_block = nullptr; - Expr Var(const Expr &x) { auto var = Expr(std::make_shared()); current_ast_builder().insert(std::make_unique( diff --git a/taichi/ir/ir.h b/taichi/ir/ir.h index 80a6964052c16..4036597d83f7e 100644 --- a/taichi/ir/ir.h +++ b/taichi/ir/ir.h @@ -1921,10 +1921,6 @@ class RangeAssumptionExpression : public Expression { } }; -// TODO: fix this hack... -// for current ast -extern Block *current_block; - class IdExpression : public Expression { public: Identifier id; diff --git a/taichi/transforms/lower_access.cpp b/taichi/transforms/lower_access.cpp index aee109ad8478e..f7230ec4946d8 100644 --- a/taichi/transforms/lower_access.cpp +++ b/taichi/transforms/lower_access.cpp @@ -17,12 +17,9 @@ class LowerAccess : public IRVisitor { } void visit(Block *stmt_list) override { - auto backup_block = current_block; - current_block = stmt_list; for (auto &stmt : stmt_list->statements) { stmt->accept(this); } - current_block = backup_block; } void visit(IfStmt *if_stmt) override { diff --git a/taichi/transforms/statement_replace.cpp b/taichi/transforms/statement_replace.cpp index 763d6debf93a9..635423276c177 100644 --- a/taichi/transforms/statement_replace.cpp +++ b/taichi/transforms/statement_replace.cpp @@ -28,12 +28,9 @@ class StatementReplace : public IRVisitor { } void visit(Block *stmt_list) override { - auto backup_block = current_block; - current_block = stmt_list; for (auto &stmt : stmt_list->statements) { stmt->accept(this); } - current_block = backup_block; } void visit(IfStmt *if_stmt) override {