tree-optimization/108574 - wrong-code with PRE PHI node processing
authorRichard Biener <rguenther@suse.de>
Mon, 30 Jan 2023 08:25:23 +0000 (09:25 +0100)
committerRichard Biener <rguenther@suse.de>
Mon, 30 Jan 2023 09:50:52 +0000 (10:50 +0100)
commit7ac3e69e311351b70407d7f87a0169c4d463e57b
tree3435a90ad55baa9432ac21daaa9f636b25629661
parent3cd08f7168c196d7a481b9ed9f4289fd1f14eea8
tree-optimization/108574 - wrong-code with PRE PHI node processing

The PR108523 was too optimistic in replacing the same value with
an equivalence from a possibly not taken edge.  The following
rectifies this and instead refrains from using the equivalence in
the problematic cases.

PR tree-optimization/108574
* tree-ssa-sccvn.cc (visit_phi): Instead of swapping
sameval and def, ignore the equivalence if there's the
danger of oscillating between two values.

* gcc.dg/torture/pr108574-1.c: New testcase.
* gcc.dg/torture/pr108574-2.c: Likewise.
* gcc.dg/torture/pr108574-3.c: Likewise.
gcc/testsuite/gcc.dg/torture/pr108574-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/torture/pr108574-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/torture/pr108574-3.c [new file with mode: 0644]
gcc/tree-ssa-sccvn.cc