From af7117a3b7f0b9f6c6cd3fb15cb1ee3869f93f5a Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Wed, 17 May 2023 11:14:34 +0300 Subject: [PATCH] Use cfg_map if available --- ir_ra.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ir_ra.c b/ir_ra.c index e833c7c..51e730b 100644 --- a/ir_ra.c +++ b/ir_ra.c @@ -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)