[llvm-bugs] [Bug 37750] New: Missed range based optimizations

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jun 8 06:14:06 PDT 2018


            Bug ID: 37750
           Summary: Missed range based optimizations
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: david.bolvansky at gmail.com
                CC: llvm-bugs at lists.llvm.org


int g2(unsigned a, unsigned b) {
  if (a > 0 && b > 0) 
    return b + a != 0;
    // return b == 0;
    // return a + b > 0;

  return -1;

Long/suboptimal code for cases above ^ - clang/llvm trunk:
g2(unsigned int, unsigned int): # @g2(unsigned int, unsigned int)
  xor ecx, ecx
  mov eax, esi
  add eax, edi
  setne cl
  cmp esi, 1
  sbb edx, edx
  cmp edi, 1
  sbb eax, eax
  or eax, edx
  or eax, ecx

g2(unsigned int, unsigned int):
  test edi, edi
  je .L3
  test esi, esi
  je .L3
  xor eax, eax
  add edi, esi
  setne al
  mov eax, -1

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/20180608/c3590220/attachment.html>

More information about the llvm-bugs mailing list