On 10/24/23 04:50, Richard Sandiford wrote:
The exit block can have multiple predecessors, for example if the
function calls __builtin_eh_return.  We might then need PHI nodes
for values that are live on exit.

RTL-SSA uses the normal dominance frontiers approach for calculating
where PHI nodes are needed.  However, dominannce.cc only calculates
dominators for normal blocks, not the exit block.
calculate_dominance_frontiers likewise only calculates dominance
frontiers for normal blocks.

This patch fills in the “missing” frontiers manually.

gcc/
        * rtl-ssa/internals.h (build_info::exit_block_dominator): New
        member variable.
        * rtl-ssa/blocks.cc (build_info::build_info): Initialize it.
        (bb_walker::bb_walker): Use it, moving the computation of the
        dominator to...
        (function_info::process_all_blocks): ...here.
        (function_info::place_phis): Add dominance frontiers for the
        exit block.
OK
jeff

Reply via email to