[Bug tree-optimization/94913] New: Failure to optimize not+cmp into overflow check

gabravier at gmail dot com gcc-bugzilla@gcc.gnu.org
Sat May 2 02:15:33 GMT 2020


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

            Bug ID: 94913
           Summary: Failure to optimize not+cmp into overflow check
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gabravier at gmail dot com
  Target Milestone: ---

bool f(unsigned x, unsigned y)
{
    return ~x < y;
}

With -O3, LLVM outputs this :

f(unsigned int, unsigned int):
  add edi, esi
  setb al
  ret

GCC outputs this :

f(unsigned int, unsigned int):
  not edi
  cmp edi, esi
  setb al
  ret


More information about the Gcc-bugs mailing list