[llvm-bugs] [Bug 45723] New: Failure to optimize out useless zero-ing after register was already zero-ed

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Apr 28 18:35:46 PDT 2020


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

            Bug ID: 45723
           Summary: Failure to optimize out useless zero-ing after
                    register was already zero-ed
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: gabravier at gmail.com
                CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
                    llvm-dev at redking.me.uk, spatel+llvm at rotateright.com

int f(bool b, int *p)
{
    return b && *p;
}

LLVM generates this with -O3 : 

f(bool, int*): # @f(bool, int*)
  xor eax, eax ; Note that eax is zero-ed here
  test dil, dil
  je .LBB0_2
  xor eax, eax ; Zero-ing eax here is thus useless
  cmp dword ptr [rsi], 0
  setne al
.LBB0_2:
  ret

-- 
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/20200429/fbd6d10e/attachment.html>


More information about the llvm-bugs mailing list