]> git.ipfire.org Git - thirdparty/gcc.git/commit
tree-optimization/117123 - missed PHI equivalence in VN
authorRichard Biener <rguenther@suse.de>
Mon, 21 Oct 2024 12:01:23 +0000 (14:01 +0200)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 22 Oct 2024 07:57:34 +0000 (09:57 +0200)
commitc33d8c55a79f08e4a14b4bc601b270268d3c4c89
tree8e066736de4fd88c7a8bfc683de579183c04e644
parent9263523b7e522e5b8c9ac70df5efc73632c19380
tree-optimization/117123 - missed PHI equivalence in VN

Value-numbering can use its set of equivalences to prove that
a PHI node with args <a_1, 5, 10> is equal to a_1 iff on the
edges with the constants a_1 == 5 and a_1 == 10 hold.  This
breaks down when the order of PHI args is <5, 10, a_1> as then
we drop to VARYING early.  The following mitigates this by
shuffling a copy of the edge vector to always process a SSA name
argument first.  Which should also handle the special-case of
a two argument <5, a_1> we already had.

PR tree-optimization/117123
* tree-ssa-sccvn.cc (visit_phi): First process a non-constant
argument edge to handle more equivalences.  Remove the
two-arg special case.

* g++.dg/tree-ssa/pr117123.C: New testcase.
gcc/testsuite/g++.dg/tree-ssa/pr117123.C [new file with mode: 0644]
gcc/tree-ssa-sccvn.cc