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