Skip to content

Commit

Permalink
Move processing of the last node of the block out of the loop
Browse files Browse the repository at this point in the history
  • Loading branch information
dstogov committed Jul 6, 2023
1 parent 59dbef0 commit d41abef
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions ir_gcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,18 @@ int ir_gcm(ir_ctx *ctx)
for (bb = ctx->cfg_blocks + b; b > 0; bb--, b--) {
IR_ASSERT(!(bb->flags & IR_BB_UNREACHABLE));
ref = bb->end;
do {

/* process the last instruction of the block */
insn = &ctx->ir_base[ref];
ir_bitset_incl(visited, ref);
_blocks[ref] = b; /* pin to block */
if (insn->inputs_count > 1) {
/* insn has input data edges */
ir_list_push_unchecked(&queue_early, ref);
}
ref = insn->op1; /* control predecessor */

while (ref != bb->start) {
insn = &ctx->ir_base[ref];
ir_bitset_incl(visited, ref);
_blocks[ref] = b; /* pin to block */
Expand All @@ -301,7 +312,9 @@ int ir_gcm(ir_ctx *ctx)
ir_list_push_unchecked(&queue_late, ref);
}
ref = insn->op1; /* control predecessor */
} while (ref != bb->start);
}

/* process the first instruction of the block */
ir_bitset_incl(visited, ref);
_blocks[ref] = b; /* pin to block */

Expand Down

0 comments on commit d41abef

Please sign in to comment.