]> git.ipfire.org Git - thirdparty/gcc.git/commit
rtl-ssa: Calculate dominance frontiers for the exit block
authorRichard Sandiford <richard.sandiford@arm.com>
Wed, 25 Oct 2023 09:39:51 +0000 (10:39 +0100)
committerRichard Sandiford <richard.sandiford@arm.com>
Wed, 25 Oct 2023 09:39:51 +0000 (10:39 +0100)
commitba97d0e3b9660e2499b9f2500a2d837cfb9cc184
tree8fda14f7e3e08278f6f0d26992554d84f4f1ee69
parentadf1b369c5321ffc213e080f8aa9d0cc8d7f9eca
rtl-ssa: Calculate dominance frontiers for the exit block

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.
gcc/rtl-ssa/blocks.cc
gcc/rtl-ssa/internals.h