[llvm-bugs] [Bug 45703] New: Failure to optimize bool comparison to an actual compare

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Apr 27 10:28:49 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=45703

            Bug ID: 45703
           Summary: Failure to optimize bool comparison to an actual
                    compare
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: gabravier at gmail.com
                CC: llvm-bugs at lists.llvm.org

bool f(bool a, bool b)
{
    return a == b;
}

This is what GCC generates : 

f(bool, bool):
  cmp dil, sil
  sete al
  ret

This is what LLVM generates : 

f(bool, bool): # @f(bool, bool)
  mov eax, edi
  xor eax, esi
  xor al, 1
  ret

What LLVM generates seems rather unatural, and `llvm-mca` indicates that GCC's
code generation is better than LLVM's here.

(see also https://godbolt.org/z/vgwvXi)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200427/a9c84612/attachment.html>


More information about the llvm-bugs mailing list