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

            Bug ID: 95187
           Summary: Failure to optimize bool check into consecutive
                    literals
           Product: gcc
           Version: 11.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: ---

int f(bool b)
{
    if (b)
        return 1;
    return 2;
}

This can be optimized into `2 - (int)b`. LLVM does this transformation, but GCC
does not.

Reply via email to