[all-commits] [llvm/llvm-project] 4e83e2: RegAlloc: Use new approach to handling failed allo...

Matt Arsenault via All-commits all-commits at lists.llvm.org
Tue Feb 25 23:17:14 PST 2025


  Branch: refs/heads/users/arsenm/regalloc/fix-assert-after-ra-failure
  Home:   https://github.com/llvm/llvm-project
  Commit: 4e83e255ae747198877c0b5534a4656bca4b4b1d
      https://github.com/llvm/llvm-project/commit/4e83e255ae747198877c0b5534a4656bca4b4b1d
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2025-02-26 (Wed, 26 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/lib/CodeGen/VirtRegMap.cpp
    A llvm/test/CodeGen/AMDGPU/agpr-copy-no-free-registers-assertion-after-ra-failure.ll
    R llvm/test/CodeGen/AMDGPU/agpr-copy-no-free-registers-assertion-after-ra-failure.xfail.ll
    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/register-killed-error-after-alloc-failure0.mir

  Log Message:
  -----------
  RegAlloc: Use new approach to handling failed allocations

This fixes an assert after allocation failure.

Rather than collecting failed virtual registers and hacking
on the uses after the fact, directly hack on the uses and rewrite
the registers to the dummy assignment immediately.

Previously we were bypassing LiveRegMatrix and directly assigning
in the VirtRegMap. This resulted in inconsistencies where illegal
overlapping assignments were missing. Rather than try to hack in
some system to manage these in LiveRegMatrix (i.e. hacking around
cases with invalid iterators), avoid this by directly using the
physreg. This should also allow removal of special casing in
virtregrewriter for failed allocations.


  Commit: 6af25a4e2bc6a872f31f833fdabc14712544a649
      https://github.com/llvm/llvm-project/commit/6af25a4e2bc6a872f31f833fdabc14712544a649
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2025-02-26 (Wed, 26 Feb 2025)

  Changed paths:
    M llvm/lib/CodeGen/VirtRegMap.cpp
    M llvm/test/CodeGen/AMDGPU/illegal-eviction-assert.mir
    M llvm/test/CodeGen/AMDGPU/issue48473.mir
    M llvm/test/CodeGen/AMDGPU/register-killed-error-after-alloc-failure0.mir

  Log Message:
  -----------
  Remove special casing in VirtRegRewriter

We could now delete FailedRegAlloc since the special case
handling is now local to the allocation passes. We're still using
it to avoid repeated errors, so that would need some new local state.


Compare: https://github.com/llvm/llvm-project/compare/709881e7ca91...6af25a4e2bc6

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