]> git.ipfire.org Git - thirdparty/gcc.git/commit
tree-ssa-dce: Avoid creating invalid BBs with no outgoing edge (PR117892)
authorMartin Jambor <mjambor@suse.cz>
Wed, 29 Jan 2025 09:51:08 +0000 (10:51 +0100)
committerMartin Jambor <jamborm@gcc.gnu.org>
Wed, 29 Jan 2025 09:51:34 +0000 (10:51 +0100)
commit3d07e7bf13d4aec794dd25b5090c139b4d78283d
treefbcf38a6e77160dd9d3a1bac67a0bc7c24c50dcf
parent5a48079c15fda4863b02eb253e473c57a5105528
tree-ssa-dce: Avoid creating invalid BBs with no outgoing edge (PR117892)

Zhendong Su and Michal Jireš found out that our gimple DSE pass can,
under fairly specific conditions, remove a noreturn call which then
leaves behind a "normal" BB with no successor edges which following
passes do not expect.  This patch simply tells the pass to leave such
calls alone even when they otherwise appear to be dead.

Interestingly, our CFG verifier does not report this.  I'll put on my
todo list to add a test for it in the next stage 1.

gcc/ChangeLog:

2025-01-28  Martin Jambor  <mjambor@suse.cz>

PR tree-optimization/117892
* tree-ssa-dse.cc (dse_optimize_call): Leave control-altering
noreturn calls alone.

gcc/testsuite/ChangeLog:

2025-01-27  Martin Jambor  <mjambor@suse.cz>

PR tree-optimization/117892
* gcc.dg/tree-ssa/pr117892.c: New test.
* gcc.dg/tree-ssa/pr118517.c: Likewise.

co-authored-by: Michal Jireš <mjires@suse.cz>
gcc/testsuite/gcc.dg/tree-ssa/pr117892.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/pr118517.c [new file with mode: 0644]
gcc/tree-ssa-dse.cc