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: [email protected]
          Reporter: [email protected]
                CC: [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to