[Bug rtl-optimization/94796] New: Failure to reuse flags from substraction

gabravier at gmail dot com gcc-bugzilla@gcc.gnu.org
Mon Apr 27 12:32:50 GMT 2020


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


More information about the Gcc-bugs mailing list