Skip to content

Commit

Permalink
Turn inline_end annotated pointless gotos into no_ops
Browse files Browse the repository at this point in the history
We can't remove them completely as that causes weird deopt issues. But turning
them into no_ops should give almost the same benefits without the cost.
  • Loading branch information
niner committed Jan 19, 2018
1 parent 834ad77 commit 8667837
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/spesh/optimize.c
Expand Up @@ -2422,9 +2422,15 @@ static void eliminate_pointless_gotos(MVMThreadContext *tc, MVMSpeshGraph *g) {
&& last_ins->info->opcode == MVM_OP_goto
&& last_ins->operands[0].ins_bb == cur_bb->linear_next
&& ! any_deopt_annotations(last_ins->annotations)
&& (! any_inline_end_annotations(last_ins->annotations))
)
MVM_spesh_manipulate_delete_ins(tc, g, cur_bb, last_ins);
) {
if (
any_inline_end_annotations(last_ins->annotations)
|| last_ins == cur_bb->first_ins // May not throw away the only instruction
)
last_ins->info = MVM_op_get_op(MVM_OP_no_op);
else
MVM_spesh_manipulate_delete_ins(tc, g, cur_bb, last_ins);
}
}
cur_bb = cur_bb->linear_next;
}
Expand Down

0 comments on commit 8667837

Please sign in to comment.