Skip to content

Commit

Permalink
Fix various missing operand use deletions
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Jul 9, 2018
1 parent 59b6fe6 commit 31a1ee8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/spesh/inline.c
Expand Up @@ -1102,6 +1102,9 @@ void MVM_spesh_inline(MVMThreadContext *tc, MVMSpeshGraph *inliner,
inlinee_last_bb, inline_boundary_handler);

/* Finally, turn the invoke instruction into a goto. */
MVM_spesh_usages_delete_by_reg(tc, inliner,
invoke_ins->operands[invoke_ins->info->opcode == MVM_OP_invoke_v ? 0 : 1],
invoke_ins);
invoke_ins->info = MVM_op_get_op(MVM_OP_goto);
invoke_ins->operands[0].ins_bb = inlinee->entry->linear_next;
tweak_succ(tc, inliner, invoke_bb, inlinee->entry->linear_next);
Expand Down
6 changes: 3 additions & 3 deletions src/spesh/optimize.c
Expand Up @@ -429,6 +429,7 @@ static void optimize_iffy(MVMThreadContext *tc, MVMSpeshGraph *g, MVMSpeshIns *i
if (truthvalue != negated_op) {
/* This conditional can be turned into an unconditional jump. */
ins->info = MVM_op_get_op(MVM_OP_goto);
MVM_spesh_usages_delete_by_reg(tc, g, ins->operands[0], ins);
ins->operands[0] = ins->operands[1];

/* Since we have an unconditional jump now, we can remove the successor
Expand Down Expand Up @@ -1563,6 +1564,7 @@ static void tweak_for_target_sf(MVMThreadContext *tc, MVMSpeshGraph *g,
guard->operands[1].lit_i16 = MVM_spesh_add_spesh_slot_try_reuse(tc, g,
(MVMCollectable *)target_sf);
guard->operands[2].lit_ui32 = deopt_target;
MVM_spesh_usages_add_by_reg(tc, g, temp, guard);
MVM_spesh_manipulate_insert_ins(tc, arg_info->prepargs_bb,
arg_info->prepargs_ins->prev, guard);

Expand All @@ -1571,10 +1573,8 @@ static void tweak_for_target_sf(MVMThreadContext *tc, MVMSpeshGraph *g,
MVM_SPESH_ANN_DEOPT_ONE_INS);

/* Make the invoke instruction call the resolved result. */
MVM_spesh_usages_delete_by_reg(tc, g, ins->operands[inv_code_index], ins);
ins->operands[inv_code_index] = temp;

/* Bump temp usage for the guard and the invoke. */
MVM_spesh_usages_add_by_reg(tc, g, temp, guard);
MVM_spesh_usages_add_by_reg(tc, g, temp, ins);
}

Expand Down

0 comments on commit 31a1ee8

Please sign in to comment.