https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119103
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization Severity|normal |enhancement Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Last reconfirmed| |2025-03-03 --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- # RANGE [irange] int [0, 65535] MASK 0xffff VALUE 0x0 _5 = (intD.6) _4; # RANGE [irange] int [0, 15] MASK 0xf VALUE 0x0 _6 = (intD.6) amount_11(D); # RANGE [irange] int [0, 2147450880] MASK 0x7fffffff VALUE 0x0 _7 = _5 << _6; _8 = (short unsigned intD.18) _7; That should be able to reduce down to just: _8 = _4 << _6; Since _6 has a range for [0,15] so we know it is defined. I suspect once that happens the other part will be optimized.