https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125589
Bug ID: 125589
Summary: `fabs([-0.0, +INF]) > nonnegative` should remove fabs
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Blocks: 26163
Target Milestone: ---
Created attachment 64617
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64617&action=edit
testcase
In the attached testcase we have the following gimple with ranges:
```
# RANGE [frange] double [-0.0 (-0x0.0p+0), +Inf] +-NAN
# USE = nonlocal escaped
# CLB = nonlocal escaped
_14 = sqrt (_13);
# RANGE [frange] double [0.0 (0x0.0p+0), +Inf] +NAN
_1 = ABS_EXPR <_14>;
if (_1 > 1.00000000000000004792173602385929598312941379845142364502e-4)
```
The sign bit does not matter here as `-0.0 > 0.0001` has the same answer as
`0.0 > 0.0001`.
This shows up in 511.povray_r.
Note this is trying to optimize the code even at -O3 rather than -Ofast.
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=26163
[Bug 26163] [meta-bug] missed optimization in SPEC (2026, 2k17, 2k and 2k6 and
95)