https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70600
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #3) > Note I think FRE handles the above incorrectly as it converts the safe > unsigned addition to non safe signed addition. I will file a different bug > about that issue. Actually I messed up the testcase and there is no bug there :). But we do need FRE to handle this case rather than just reassoicate: int f(int a, int b, int d) { unsigned a1 = a; unsigned b1 = b; unsigned c1 = a1 + b1; if (a <= 0 || b <= 0) return 0; int c = c1; if (d) c = a + b; return c; } --- CUT ---- We should also handle cases where the lower sizes are done too (just need to truncate inside the if). I have seen both of these before in real code.