https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83133
--- Comment #15 from Marc Glisse <glisse at gcc dot gnu.org> --- Gcc's RTL internal representation sees the same thing for your code and for int diff = (unsigned)a - (unsigned)b; llvm represents both differently and generates different code for the two.