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.
4 files changed