[Bug middle-end/102580] Failure to optimize signed division to unsigned division when dividend can't be negative

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Oct 17 21:02:40 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102580

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
We can do it for:
int f(int x) {
  if (x < 0) 
    __builtin_abort();
  x+=1;
  return x/3;
}

expand_expr_divmod has the code already to handle this, just needs a range. 
Expand would do querry to get better ranges really.


More information about the Gcc-bugs mailing list