tree-optimization/99694 - fix value-numbering PHIs
authorRichard Biener <rguenther@suse.de>
Mon, 22 Mar 2021 10:09:46 +0000 (11:09 +0100)
committerRichard Biener <rguenther@suse.de>
Mon, 22 Mar 2021 13:37:26 +0000 (14:37 +0100)
commitb931e4792b8696f3da69f70988720c4d1ec6142a
treea666bbbf3e9d9ea76035565ddb390247569e4354
parentc4519fe3db366d781f342b7f04c4a09e4cc9fbd9
tree-optimization/99694 - fix value-numbering PHIs

This avoids endless cycling when a PHI node with unchanged backedge
value (the PHI result appearing there) is subject to CSE since doing
that effectively alters the hash entry.  The way to avoid this is
to ignore such edges when processing the PHI node.

2021-03-22  Richard Biener  <rguenther@suse.de>

PR tree-optimization/99694
* tree-ssa-sccvn.c (visit_phi): Ignore edges with the
PHI result.

* gcc.dg/torture/pr99694.c: New testcase.
gcc/testsuite/gcc.dg/torture/pr99694.c [new file with mode: 0644]
gcc/tree-ssa-sccvn.c