https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81346
--- Comment #8 from Marc Glisse <glisse at gcc dot gnu.org> --- I think always using an unsigned type for the range check would be simpler. If we try to check that x>=INT_MIN+2 && x<=INT_MAX-2 with -fwrapv, int is still not a suitable type in which to do x-(INT_MIN+2)<=INT_MAX-2-(INT_MIN+2), while the issue doesn't exist with an unsigned type. I notice you call build_range_check in GENERIC (and new code for GIMPLE). Is that temporary until match.pd can optimize range checks? Do we want :s on trunc_div?