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: unassignedb...@nondot.org
          Reporter: gabrav...@gmail.com
                CC: craig.top...@gmail.com, llvm-bugs@lists.llvm.org,
                    llvm-...@redking.me.uk, spatel+l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to