[all-commits] [llvm/llvm-project] e28708: RegisterCoalescer: Avoid redundant implicit-def on...

Matt Arsenault via All-commits all-commits at lists.llvm.org
Mon Oct 2 03:34:09 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e28708d4f03889214066fba81072f974864b919f
      https://github.com/llvm/llvm-project/commit/e28708d4f03889214066fba81072f974864b919f
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2023-10-02 (Mon, 02 Oct 2023)

  Changed paths:
    M llvm/lib/CodeGen/RegisterCoalescer.cpp
    M llvm/test/CodeGen/X86/rematerialize-sub-super-reg.mir

  Log Message:
  -----------
  RegisterCoalescer: Avoid redundant implicit-def on rematerialize

If this was coalescing a def of a subregister with a def of the super
register, it was introducing a redundant super-register def and
marking the subregister def as dead.

Resulting in something like:

  dead $eax = MOVr0, implicit-def $rax, implicit-def $rax

Avoid this by checking if the new instruction already has the super
def, so we end up with this instead:

  dead $eax = MOVr0, implicit-def $rax

The dead flag looks suspicious to me, seems like it's easy to buggily
interpret dead def of subreg and a non-dead def of an aliasing
register. It seems to be intentional though.

https://reviews.llvm.org/D156343




More information about the All-commits mailing list