https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113268
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Keywords| |missed-optimization Status|UNCONFIRMED |NEW Last reconfirmed| |2024-01-09 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- (i + 1) * CST and i * CST + 1 * CST can have different overflow behavior, so (i + 1) * CST cannot be turned into i * CST + CST unconditionally. The reverse transform would be valid through I think. RTL or GIMPLE with -fwrapv should be able to handle both the same. There's still the old idea of making late GIMPLE effectively -fwrapv, the same as RTL behaves.