https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119690
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |glisse at gcc dot gnu.org
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Reproudces with -O -ftree-vrp, the issue shows up when VRP2 is enabled but only
when IVOPTs mangled the code.
FRE1 via folding turns
<bb 2> :
d:
a.0_1 = a;
b.1_2 = b;
_3 = a.0_1 + b.1_2;
_4 = _3 + 2147483647;
c = _4;
c.2_5 = c;
if (c.2_5 <= 0)
goto <bb 3>; [INV]
else
goto <bb 4>; [INV]
<bb 3> :
// predicted unlikely by goto predictor.
c.3_6 = c;
_7 = c.3_6 + 1;
a = _7;
// predicted unlikely by goto predictor.
goto <bb 2>; [INV]
into
<bb 3> :
// predicted unlikely by goto predictor.
_7 = _3 - -2147483648;
a = _7;
// predicted unlikely by goto predictor.
goto <bb 2>; [INV]
that's the
/* (A +- CST1) +- CST2 -> A + CST3
Use view_convert because it is safe for vectors and equivalent for
scalars. */
...
/* X+INT_MAX+1 is X-INT_MIN. */
(if (INTEGRAL_TYPE_P (type)
&& wi::to_wide (cst) == wi::min_value (type))
(neg_inner_op @0 { wide_int_to_tree (type, wi::to_wide (cst)); })
case.
Originally we compute { 0, +, 1 } here, now in the first iteration
we do 0 - -2147483648.
It does not look like that's OK. This was added by r8-1516-ged73f46f30cabe.