Skip to content

Commit

Permalink
[refactor] Remove dependency on lang::current_ast_builder() in lang::…
Browse files Browse the repository at this point in the history
…ConstantFold (#4123)
  • Loading branch information
PGZXB authored Jan 25, 2022
1 parent 42b0768 commit 7dd646d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions taichi/transforms/constant_fold.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ConstantFold : public BasicStmtVisitor {
return it->second.get();

auto kernel_name = fmt::format("jit_evaluator_{}", cache.size());
auto func = [&id]() {
auto func = [&id, this]() {
auto lhstmt =
Stmt::make<ArgLoadStmt>(/*arg_id=*/0, id.lhs, /*is_ptr=*/false);
auto rhstmt =
Expand All @@ -49,11 +49,11 @@ class ConstantFold : public BasicStmtVisitor {
}
}
auto ret = Stmt::make<ReturnStmt>(oper.get());
current_ast_builder().insert(std::move(lhstmt));
program->current_ast_builder()->insert(std::move(lhstmt));
if (id.is_binary)
current_ast_builder().insert(std::move(rhstmt));
current_ast_builder().insert(std::move(oper));
current_ast_builder().insert(std::move(ret));
program->current_ast_builder()->insert(std::move(rhstmt));
program->current_ast_builder()->insert(std::move(oper));
program->current_ast_builder()->insert(std::move(ret));
};

auto ker = std::make_unique<Kernel>(*program, func, kernel_name);
Expand Down

0 comments on commit 7dd646d

Please sign in to comment.