Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[interp] Skip emitting redundant branch to next basic block
  • Loading branch information
BrzVlad committed May 4, 2021
commit b6d7053c899fe5654607bfb20fbf487d8e691a8c
4 changes: 4 additions & 0 deletions src/mono/mono/mini/interp/transform.c
Original file line number Diff line number Diff line change
Expand Up @@ -7549,6 +7549,9 @@ emit_compacted_instruction (TransformData *td, guint16* start_ip, InterpInst *in
if (ins->info.target_bb->native_offset >= 0) {
// Backwards branch. We can already patch it.
*ip++ = ins->info.target_bb->native_offset - br_offset;
} else if (opcode == MINT_BR_S && ins->info.target_bb == td->cbb->next_bb) {
// Ignore branch to the next basic block. Revert the added MINT_BR_S.
ip--;
} else {
// We don't know the in_offset of the target, add a reloc
Reloc *reloc = (Reloc*)mono_mempool_alloc0 (td->mempool, sizeof (Reloc));
Expand Down Expand Up @@ -7696,6 +7699,7 @@ generate_compacted_code (TransformData *td)
for (bb = td->entry_bb; bb != NULL; bb = bb->next_bb) {
InterpInst *ins = bb->first_ins;
bb->native_offset = ip - td->new_code;
td->cbb = bb;
while (ins) {
ip = emit_compacted_instruction (td, ip, ins);
ins = ins->next;
Expand Down