https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70527
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2016-04-04 Ever confirmed|0 |1 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- Note the issue is (non-)canonicalization of (long)(x + 1). For optimal re-assoc you'd want to canonicalize this to (long)x + 1L (with x + 1 having undefined behavior on overflow) and then to (long)x * 12 + 12. But generally you do _not_ want to do this because you lose value-range info and carry out the op in a larger mode (the former means the reverse transform is not valid). Generic folding has very limited capabilities here and GIMPLE reassoc currently refuses to associate signed ops at all.