[Bug target/94838] Failure to optimize out useless zero-ing after register was already zero-ed

gabravier at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Apr 29 06:51:31 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94838

--- Comment #3 from Gabriel Ravier <gabravier at gmail dot com> ---
This also occurs on i68* : 

f(bool, int*):
  xor eax, eax ; Already 0
  cmp BYTE PTR [esp+4], 0
  je .L1
  mov eax, DWORD PTR [esp+8] ; Could use different caller-saved register such
as ecx or edx
  mov eax, DWORD PTR [eax]
  test eax, eax
  setne al
  movzx eax, al ; This could then be avoided since eax would already be 0
.L1:
  ret


More information about the Gcc-bugs mailing list