https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117123
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Version|unknown |15.0
Assignee|pheeck at gcc dot gnu.org |rguenth at gcc dot
gnu.org
--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> ---
So without SCCCOPY we do
Starting insert iteration 1
Replaced redundant PHI node defining spud_0_16 with patatino_a.0_1
Replaced redundant PHI node defining spud_0_6 with patatino_a.0_1
Replaced redundant PHI node defining k_7 with 0
Replaced _2 & _19 with 0 in all uses of _18 = _2 & _19;
Removing unexecutable edge from if (_18 != 0)
so we're not doing any insertion but we are instead able to simplify. With
SCCCOPY
Starting insert iteration 1
Skipping partial redundancy for expression {gt_expr,spud_0_15,1000} (0026), no
redundancy on to be optimized for speed edge
Skipping partial redundancy for expression {bit_and_expr,pretmp_8,_18} (0027),
no redundancy on to be optimized for speed edge
Skipping partial redundancy for expression {mult_expr,k_6,l_25} (0002), no
redundancy on to be optimized for speed edge
Skipping partial redundancy for expression {plus_expr,_2,spud_0_23} (0008), no
redundancy on to be optimized for speed edge
Skipping partial redundancy for expression {plus_expr,l_25,1} (0009), no
redundancy on to be optimized for speed edge
I think the difference is in value-numbering, in the good case we do
-Value numbering stmt = spud_0_16 = PHI <patatino_a.0_1(17), 10(19), 0(16)>
-Predication says 10 and patatino_a.0_1 are equal on edge 19 -> 4
-Predication says 0 and patatino_a.0_1 are equal on edge 16 -> 4
-Setting value number of spud_0_16 to patatino_a.0_1 (changed)
while in the bad case
+Value numbering stmt = spud_0_15 = PHI <10(19), 0(16), patatino_a.0_1(17)>
+Setting value number of spud_0_15 to spud_0_15 (changed)
+Making available beyond BB5 spud_0_15 for value spud_0_15
so what tree-ssa-sccvn.cc:visit_phi does is dependent on the order of
arguments. This is because for the use of equivalences we seek for
patatino_a.0_1 == 10 on the 19->4 edge but with the other order we look
for 10 == 0 on the 16->5 edge but such kind of equivalence is of course
not present. For the equivalence code to work best we'd need to make sure
to first process an edge with a varying SSA def.
I'll see how to arrive at this without confusing the code even more.