https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103721
--- Comment #7 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
After chatting with Andrew about this, it seems the problem is we are starting
a path mid-loop and crossing a backedge. This causes us to use relations we
had on one iteration in another iteration.
<bb 8> [local count: 955630225]:
# searchVolume_11 = PHI <1(4), 0(3)>
# currentVolume_8 = PHI <searchVolume_5(4), searchVolume_5(3)>
# **BACKEDGE**
<bb 9> [local count: 1073741824]:
# searchVolume_5 = PHI <searchVolume_11(8), world_7(D)(2)>
# currentVolume_6 = PHI <currentVolume_8(8), 0(2)>
_2 = searchVolume_5 != currentVolume_6;
_3 = searchVolume_5 != 0;
_4 = _2 & _3;
if (_4 != 0)
goto <bb 3>; [89.00%]
else
goto <bb 7>; [11.00%]
...
...
<bb3>
<bb4>
<bb8>
The _8 == _5 relation in BB8 is using _5 from a previous iteration (that came
through BB9). Basically 8->9 has a use before def of _5.
Once we hit a back edge, we should probably kill all current relations and
disable looking outside the path altogether for relations.
I will experiment.