Fix PR 103317, ICE after PHI-OPT, minmax_replacement producing invalid SSA
authorAndrew Pinski <apinski@marvell.com>
Thu, 18 Nov 2021 23:38:30 +0000 (23:38 +0000)
committerAndrew Pinski <apinski@marvell.com>
Fri, 19 Nov 2021 07:18:23 +0000 (07:18 +0000)
commit09d462146b3107c665265b11ad925c61a91c6efb
tree03e6954073123ca810cfb28a51ede5da2d1ec1fe
parent527e54a431473cc497204226a21f2831d2375e66
Fix PR 103317, ICE after PHI-OPT, minmax_replacement producing invalid SSA

The problem is r12-5300-gf98f373dd822b35c allows phiopt to recognize more basic blocks
but missed one location where the basic block does not need to be empty but still
needs to have a single predecessor. This patch fixes that over sight.

OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

PR tree-optimization/103317

gcc/ChangeLog:

* tree-ssa-phiopt.c (minmax_replacement): For the non empty
middle bb case, check to make sure it has a single predecessor.

gcc/testsuite/ChangeLog:

* gcc.c-torture/compile/pr103317-1.c: New test.
gcc/testsuite/gcc.c-torture/compile/pr103317-1.c [new file with mode: 0644]
gcc/tree-ssa-phiopt.c