https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94796
Bug ID: 94796 Summary: Failure to reuse flags from substraction Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: gabravier at gmail dot com Target Milestone: --- int f(int a, int b) { return ((a == b) & (a - b)); } The `a == b` is able to use condition flags resulting from `a - b`, and thus avoid an extra compare. LLVM does this transformation, but GCC does not. https://godbolt.org/z/SHvTW8