Skip to content

Commit

Permalink
fix(ir): unreach_elim for empty blocks after tco
Browse files Browse the repository at this point in the history
  • Loading branch information
suhipek committed Aug 20, 2023
1 parent 393d651 commit 5dd43a8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ int main(int argc, char* argv[]) {
ir::dce(ir_builder);
ir::strength_reduce(ir_builder);
ir::tco(ir_builder);
ir::unreach_elim(ir_builder);
ir::loop_invariant_motion(ir_builder);
for (int i = 0; i < 3; i++) {
ir::peephole(ir_builder);
Expand Down
3 changes: 2 additions & 1 deletion src/passes/ir/tco.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ bool is_inst_tail_call(
return std::visit(overloaded {
[&](instruction::Call& call_inst) {
return is_inst_tail_call(inst->next, function, builder) &&
function->name == call_inst.function_name;
function->name == call_inst.function_name &&
function->parameter_id_list.size() < 30;
},
[&](instruction::Br& br_inst) {
auto next_block = builder.context.basic_block_table[br_inst.block_id];
Expand Down

0 comments on commit 5dd43a8

Please sign in to comment.