]> git.ipfire.org Git - thirdparty/gcc.git/commit
gimple: sccopy: Prune removed statements from SCCs [PR117919]
authorFilip Kastl <fkastl@suse.cz>
Sun, 2 Mar 2025 05:39:17 +0000 (06:39 +0100)
committerFilip Kastl <fkastl@suse.cz>
Sun, 2 Mar 2025 05:39:17 +0000 (06:39 +0100)
commit5349aa2accdf34a7bf9cabd1447878aaadfc0e87
tree0df81b7f14a2e83cbbea0cd687c12f0f089acc41
parent88e620c8d55a889c33e12b218cd51a3e6ac5011d
gimple: sccopy: Prune removed statements from SCCs [PR117919]

While writing the sccopy pass I didn't realize that 'replace_uses_by ()' can
remove portions of the CFG.  This happens when replacing arguments of some
statement results in the removal of an EH edge.  Because of this sccopy can
then work with GIMPLE statements that aren't part of the IR anymore.  In
PR117919 this triggered an assertion within the pass which assumes that
statements the pass works with are reachable.

This patch tells the pass to notice when a statement isn't in the IR anymore
and remove it from it's worklist.

PR tree-optimization/117919

gcc/ChangeLog:

* gimple-ssa-sccopy.cc (scc_copy_prop::propagate): Prune
statements that 'replace_uses_by ()' removed.

gcc/testsuite/ChangeLog:

* g++.dg/pr117919.C: New test.

Signed-off-by: Filip Kastl <fkastl@suse.cz>
gcc/gimple-ssa-sccopy.cc
gcc/testsuite/g++.dg/pr117919.C [new file with mode: 0644]