https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125706

Drea Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2026-06-10
     Ever confirmed|0                           |1
           Keywords|                            |missed-optimization
             Blocks|                            |85316
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Drea Pinski <pinskia at gcc dot gnu.org> ---
```
  # RANGE [irange] int [100, 101] MASK 0x1 VALUE 0x64
  _6 = (int) v5_i8_14(D);
  # RANGE [irange] int [65, 80] MASK 0x1f VALUE 0x40
  _7 = (int) v4_i8_13(D);
  # RANGE [irange] int [0, 79] MASK 0x7f VALUE 0x0
  _8 = _6 % _7;
```

Looks like the range of the mod is not as good as LLVM gets I think.

In this case:
the range is 
[20, 35] union [21,36] or rather [20,36].

And then the range for the shift:
  # RANGE [irange] int [6, 7] MASK 0x1 VALUE 0x6
  _10 = (int) v2_u8_12(D);
  # RANGE [irange] int [0, 1] MASK 0x1 VALUE 0x0
  _11 = _9 >> _10;

Should be 0.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85316
[Bug 85316] [meta-bug] VRP range propagation missed cases

Reply via email to