Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jim19930609 committed Jan 5, 2023
1 parent 2bbaa95 commit f007b03
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 5 additions & 6 deletions taichi/ir/frontend_ir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@ FrontendSNodeOpStmt::FrontendSNodeOpStmt(ASTBuilder *builder,
}
}

FrontendReturnStmt::FrontendReturnStmt(ASTBuilder *builder,
const ExprGroup &group) {
values = group;
auto expanded_exprs = builder->expand_exprs(values.exprs);
values.exprs = std::move(expanded_exprs);
FrontendReturnStmt::FrontendReturnStmt(const ExprGroup &group) : values(group) {
}

FrontendAssignStmt::FrontendAssignStmt(const Expr &lhs, const Expr &rhs)
Expand Down Expand Up @@ -1345,7 +1341,10 @@ Expr ASTBuilder::insert_patch_idx_expr() {
}

void ASTBuilder::create_kernel_exprgroup_return(const ExprGroup &group) {
this->insert(Stmt::make<FrontendReturnStmt>(this, group));
auto expanded_exprs = this->expand_exprs(group.exprs);
ExprGroup expanded_expr_group;
expanded_expr_group.exprs = std::move(expanded_exprs);
this->insert(Stmt::make<FrontendReturnStmt>(expanded_expr_group));
}

void ASTBuilder::create_print(
Expand Down
2 changes: 1 addition & 1 deletion taichi/ir/frontend_ir.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ class FrontendReturnStmt : public Stmt {
public:
ExprGroup values;

explicit FrontendReturnStmt(ASTBuilder *builder, const ExprGroup &group);
explicit FrontendReturnStmt(const ExprGroup &group);

bool is_container_statement() const override {
return false;
Expand Down

0 comments on commit f007b03

Please sign in to comment.