https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112857
Bug ID: 112857 Summary: Missing optimzation: fold (b + ~a) > 0 to a - b < -1 Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: xxs_chy at outlook dot com Target Milestone: --- Godbolt link example: https://godbolt.org/z/Pba4Y164f For c code like: bool src(int a, int b){ return (b + ~a) > 0; } can be folded to: bool tgt(int a, int b){ return a - b < -1; } But both GCC and LLVM missed it.