https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128292
--- Comment #5 from Drea Pinski <pinskia at gcc dot gnu.org> --- So in GCC 14-16, before backprop: ``` # RANGE [frange] double [-Inf, +Inf] # iftmp.0_6 = PHI <a_7(D)(2), 0.0(3)> # RANGE [frange] double [0.0 (0x0.0p+0), +Inf] +NAN x_12 = ABS_EXPR <iftmp.0_6>; _14 = x_12 < 0.0; _15 = _14 ? 0.0 : x_12; # RANGE [frange] double [0.0 (0x0.0p+0), +Inf] +-NAN res_16 = _15 * 2.0e+0; ... # RANGE [frange] double [0.0 (0x0.0p+0), +Inf] +NAN _3 = ABS_EXPR <res_16>; ``` After: ``` # RANGE [frange] double [-Inf, +Inf] # iftmp.0_6 = PHI <a_7(D)(2), 0.0(3)> # RANGE [frange] double [0.0 (0x0.0p+0), +Inf] +NAN x_12 = ABS_EXPR <iftmp.0_6>; _14 = x_12 < 0.0; _15 = _14 ? 0.0 : iftmp.0_6; # RANGE [frange] double [0.0 (0x0.0p+0), +Inf] +-NAN res_16 = _15 * 2.0e+0; ... # RANGE [frange] double [0.0 (0x0.0p+0), +Inf] +NAN _3 = ABS_EXPR <res_16>; ``` So we remove an abs there which is ok, except we didn't update the range of res_16. And later on passes will remove the ABS_EXPR due to that. On the trunk after the commit to backprop we get: ``` # RANGE [frange] double [-Inf, +Inf] # iftmp.0_6 = PHI <a_7(D)(2), 0.0(3)> # RANGE [frange] double [0.0 (0x0.0p+0), +Inf] +NAN x_12 = ABS_EXPR <iftmp.0_6>; _14 = x_12 < 0.0; _19 = _14 ? 0.0 : iftmp.0_6; res_13 = _19 * 2.0e+0; ... # RANGE [frange] double [0.0 (0x0.0p+0), +Inf] +NAN _3 = ABS_EXPR <res_13>; ``` Which is correct now as res_13 does not have a range. Though I do think we have a missing optimization in the first place. The ABS_EXPR for res_* should have been removed in the first place but currently is not because of the NaN in x_12 which can't show up.
