https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92734
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I'm wondering if we shouldn't adjust also the /* (A +- B) - A -> +- B */ /* (A +- B) -+ B -> A */ /* A - (A +- B) -> -+ B */ /* A +- (B -+ A) -> +- B */ patterns. Say testcases like: int f1 (int x, unsigned y) { return (int) (x + y) - x; } int f2 (int x, unsigned y) { int a = x + y; return a - x; } aren't really optimized ATM until combine. And they aren't really optimized even with -fwrapv until combine, so the "turn on -fwrapv late in GIMPLE and redoce a few optimizations" proposal wouldn't solve that.