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

            Bug ID: 110155
           Summary: Missing if conversion
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ubizjak at gmail dot com
  Target Milestone: ---

Following testcase:

--cut here--
#include <stdbool.h>

_Bool foo (void);

int bar (int r)
{
  if (foo ())
    r++;

  return r;
}
--cut here--

compiles (gcc -O2) to:

        movl    %edi, %ebx
        call    foo
        cmpb    $1, %al
        sbbl    $-1, %ebx
        movl    %ebx, %eax

could be performed without compare as:

        movl    %edi, %ebx
        callq   foo
        movzbl  %al, %eax
        addl    %ebx, %eax

Reply via email to