https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114660
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2024-04-09 Ever confirmed|0 |1 --- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #2) > We don't do as much reassociation as we should with signed integers due to > overflow. If you use -fwrapv, you get the reassociation; I am 99% sure there > is a dup for this bug too. I should say we also do it for unsigned already (see PR 95867), -fwrapv case we just treat signed similar to unsigned here. Anyways what needs to happen is we need 2 levels of gimple, one with signed integer overflow behavior and then one with wrapping behavior. RTL does not distinguish between signed and unsigned behaviors for many operations (plus and multiple) so we get some optimizations there but not all.