[all-commits] [llvm/llvm-project] d4b1be: RegAllocGreedy: Fix illegal eviction assert for ur...

Matt Arsenault via All-commits all-commits at lists.llvm.org
Tue Apr 12 16:17:10 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d4b1be20f6e52f4f966b7bd471f197c685a255e2
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2022-04-12 (Tue, 12 Apr 2022)

  Changed paths:
    M llvm/lib/CodeGen/RegAllocEvictionAdvisor.cpp
    A llvm/test/CodeGen/AMDGPU/illegal-eviction-assert.mir
    A llvm/test/CodeGen/AMDGPU/regalloc-illegal-eviction-assert.ll

  Log Message:
  RegAllocGreedy: Fix illegal eviction assert for urgent evictions

The condition in canEvictInterferenceBasedOnCost is slightly different
from the assertion in evictInteference.
canEvictInterferenceBasedOnCost uses a <= check for the cascade number
for legality, but the assert was checking for <. For equal cascade
numbers for an urgent eviction, canEvictInterferenceBasedOnCost could
return success. The actual eviction would then hit this assert. Avoid
ever returning true for equivalent cascade numbers.

The resulting failed allocation seems a bit off to me. e.g. in
illegal-eviction-assert.mir, I wuold assume %0 gets allocated starting
at $vgpr0. That was its initial allocation choice, but was later
evicted. In this example no evictions can help improve anything.

More information about the All-commits mailing list