https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96685
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Target| |x86_64-*-* i?86-*-* Last reconfirmed| |2020-08-25 Status|UNCONFIRMED |NEW --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- It's at least a missed canonicalization as ~x + y isn't transformed to ~(x - y) either. int f(int x, int y) { return ~(x - y) + (~x + y); } should see CSE, with a minus folding to zero (that works already for some reason).