[all-commits] [llvm/llvm-project] 34167f: RegAlloc: Fix verifier error after failed allocati...

Matt Arsenault via All-commits all-commits at lists.llvm.org
Fri Feb 21 07:12:15 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 34167f99668ce4d4d6a1fb88453a8d5b56d16ed5
      https://github.com/llvm/llvm-project/commit/34167f99668ce4d4d6a1fb88453a8d5b56d16ed5
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2025-02-21 (Fri, 21 Feb 2025)

  Changed paths:
    M llvm/lib/CodeGen/RegAllocBase.cpp
    M llvm/lib/CodeGen/RegAllocBase.h
    M llvm/lib/CodeGen/RegAllocBasic.cpp
    M llvm/lib/CodeGen/RegAllocGreedy.cpp
    M llvm/test/CodeGen/AMDGPU/illegal-eviction-assert.mir
    M llvm/test/CodeGen/AMDGPU/inflated-reg-class-snippet-copy-use-after-free.mir
    M llvm/test/CodeGen/AMDGPU/issue48473.mir
    M llvm/test/CodeGen/AMDGPU/ran-out-of-registers-error-all-regs-reserved.ll
    M llvm/test/CodeGen/AMDGPU/regalloc-failure-overlapping-insert-assert.mir
    A llvm/test/CodeGen/AMDGPU/register-killed-error-after-alloc-failure0.mir
    A llvm/test/CodeGen/AMDGPU/register-killed-error-after-alloc-failure1.ll
    M llvm/test/CodeGen/AMDGPU/remaining-virtual-register-operands.ll
    M llvm/test/CodeGen/X86/inline-asm-assertion.ll

  Log Message:
  -----------
  RegAlloc: Fix verifier error after failed allocation (#119690)

In some cases after reporting an allocation failure, this would fail
the verifier. It picks the first allocatable register and assigns it,
but didn't update the liveness appropriately. When VirtRegRewriter
relied on the liveness to set kill flags, it would incorrectly add
kill flags if there was another overlapping kill of the virtual
register.

We can't properly assign the register to an overlapping range, so
break the liveness of the failing register (and any other interfering
registers) instead. Give the virtual register dummy liveness by
effectively deleting all the uses by setting them to undef.

The edge case not tested here which I'm worried about is if the read
of the register is a def of a subregister. I've been unable to come up
with a test where this occurs.

https://reviews.llvm.org/D122616



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list