diff options
author | Andrew Pinski <apinski@marvell.com> | 2021-11-16 23:37:08 +0000 |
---|---|---|
committer | Andrew Pinski <apinski@marvell.com> | 2021-11-17 08:04:14 +0000 |
commit | 1a15a91a0015208eafb797e4de1348c9877fd6d0 (patch) | |
tree | 96e087c5056cc0dbe5634b06222456ebc4e731c8 /gcc/tree-ssa-phiopt.c | |
parent | b8ce19bb1a0592051e8f9a4c3252d12ae605b256 (diff) | |
download | gcc-1a15a91a0015208eafb797e4de1348c9877fd6d0.zip gcc-1a15a91a0015208eafb797e4de1348c9877fd6d0.tar.gz gcc-1a15a91a0015208eafb797e4de1348c9877fd6d0.tar.bz2 |
Fix PR 103288, ICE after PHI-OPT, move an assigment when still in use for another bb
The problem is r12-5300-gf98f373dd822b35c allows phiopt to recognize more basic blocks
but missed one location where phiopt could move an assignment from the middle block
to the non-middle one. This patch fixes that.
OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.
PR tree-optimization/103288
gcc/ChangeLog:
* tree-ssa-phiopt.c (value_replacement): Return early if middle
block has more than one pred.
gcc/testsuite/ChangeLog:
* gcc.c-torture/compile/pr103288-1.c: New test.
Diffstat (limited to 'gcc/tree-ssa-phiopt.c')
-rw-r--r-- | gcc/tree-ssa-phiopt.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c index 6b22f6b..8984a5e 100644 --- a/gcc/tree-ssa-phiopt.c +++ b/gcc/tree-ssa-phiopt.c @@ -1381,6 +1381,9 @@ value_replacement (basic_block cond_bb, basic_block middle_bb, } } + if (!single_pred_p (middle_bb)) + return 0; + /* Now optimize (x != 0) ? x + y : y to just x + y. */ gsi = gsi_last_nondebug_bb (middle_bb); if (gsi_end_p (gsi)) |