On Fri, Jun 06, 2025 at 10:54:55AM -0400, Andrew MacLeod wrote: > I don't remember details about the order of things... Is there any chance > that you might query an SSA_NAME whose DEF was in a block which has been > converted to RTL? Ranger will query all the way back to the def block, > accessed via gimple_bb (SSA_NAME_DEF_STMT (name)), or top of program looking > for it. But I presume that won't happen? You wouldn't get anything wrong, > just inefficient.
Expansion is done in the FOR_BB_BETWEEN (bb, init_block->next_bb, EXIT_BLOCK_PTR_FOR_FN (fun), next_bb) bb = expand_gimple_basic_block (bb, var_ret_seq != NULL_RTX); order, not anything more complicated (and furthermore all PHIs are dropped even before that). Furthermore, we don't really know if we'll need to ask about range of something or not, so doing full IL range computation (in the evrp/vrp/dom passes style) might be a waste of time. With the patch I've posted, all the GIMPLE IL is still around until the last expand_gimple_basic_block call, so with the small tweaks (the possibly NULL default switch edge, some extra added BB_RTL basic blocks, but with the patch not really any of the original GIMPLE ones, maybe one of the GIMPLE_COND edges could be dropped in rare cases) so ranger can still walk it forward and backward as it pleases, and the switches of all the remaing bbs to BB_RTL are done right after that loop. Jakub