Removing block continuation branches.

This commit is contained in:
Ben Vanik 2014-01-25 21:35:59 -08:00
parent f438fa980d
commit 05432242ff
1 changed files with 10 additions and 1 deletions

View File

@ -52,7 +52,16 @@ int FinalizationPass::Run(HIRBuilder* builder) {
label = label->next; label = label->next;
} }
// ? remove useless jumps? // Remove unneeded jumps.
auto tail = block->instr_tail;
if (tail && tail->opcode == &OPCODE_BRANCH_info) {
// Jump. Check target.
auto target = tail->src1.label;
if (target->block == block->next) {
// Jumping to subsequent block. Remove.
tail->Remove();
}
}
// Renumber all instructions to make liveness tracking easier. // Renumber all instructions to make liveness tracking easier.
uint32_t instr_ordinal = 0; uint32_t instr_ordinal = 0;