https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80006
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
VRP does
Visiting PHI node: x_4 = PHI <x_10(5), -4(3)>
Argument #0 (5 -> 4 executable)
x_10: ~[-3, 7] EQUIVALENCES: { x_5(D) } (1 elements)
Argument #1 (3 -> 4 executable)
-4: [-4, -4]
Meeting
~[-3, 7] EQUIVALENCES: { x_5(D) } (1 elements)
and
[-4, -4]
to
~[-3, 7] EQUIVALENCES: { } (0 elements)
Found new range for x_4: ~[-3, 7]
marking stmt to be not simulated again
Visiting statement:
_3 = (int) x_4;
Meeting
[-128, -4]
and
[8, 127]
to
[-128, 127]
...
Found new range for _3: [-128, 127]
it thinks that [-128, 127] is better than ~[-3, 7] which I'd be inclined to
agree to as it is much smaller.
It's a "defect" in our range representation that we can't have _3s range
[-128, -4] union [8, 127]. We are also not considering _4 as an equivalence,
maybe we could do that (even if it has different type) for the cases where
this would be valid. That would of course only help VRP itself as range-info
for other passes would still be [-128,127] (and improving range representation
for SSA names is much more costly as enhancing the VRP lattice).
But I think I argued for integrating warnings that want value-range information
with VRP, did I?
Not really a bug, rather a feature.