Use cfg_map if available

This commit is contained in:
Dmitry Stogov 2023-05-17 11:14:34 +03:00
parent aba7818b00
commit af7117a3b7

View File

@ -2214,9 +2214,11 @@ static ir_live_pos ir_first_use_pos_after(ir_live_interval *ival, ir_live_pos po
static ir_block *ir_block_from_live_pos(ir_ctx *ctx, ir_live_pos pos)
{
ir_ref ref = IR_LIVE_POS_TO_REF(pos);
#ifdef IR_BITSET_LIVENESS
uint32_t b;
ir_block *bb;
ir_ref ref = IR_LIVE_POS_TO_REF(pos);
// TODO: use binary search or map
for (b = 1, bb = ctx->cfg_blocks + 1; b <= ctx->cfg_blocks_count; b++, bb++) {
@ -2226,6 +2228,9 @@ static ir_block *ir_block_from_live_pos(ir_ctx *ctx, ir_live_pos pos)
}
IR_ASSERT(0);
return NULL;
#else
return &ctx->cfg_blocks[ctx->cfg_map[ref]];
#endif
}
static ir_live_pos ir_find_optimal_split_position(ir_ctx *ctx, ir_live_interval *ival, ir_live_pos min_pos, ir_live_pos max_pos, bool prefer_max)