[PATCH] D122580: RegAllocGreedy: Roll back successful recolorings on failure

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 28 06:12:33 PDT 2022


arsenm created this revision.
arsenm added reviewers: qcolombet, MatzeB, kparzysz, uabelho.
Herald added subscribers: luke957, frasercrmck, kerbowa, luismarques, apazos, sameer.abuasal, s.egerton, Jim, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya, jvesely.
Herald added a project: All.
arsenm requested review of this revision.
Herald added subscribers: pcwang-thead, MaskRay, wdng.
Herald added a project: LLVM.

This is a replacement for the original fix attempted in
c46aab01c002b7a04135b8b7f1f52d8c9ae23a58 <https://reviews.llvm.org/rGc46aab01c002b7a04135b8b7f1f52d8c9ae23a58>.

      

This fixes "overlapping insert" assertion failures when trying to
unwind an unsuccessful recoloring attempt.

      

The problem would occur when there are multiple recoloring candidates
which recursively required recoloring. If one recoloring candidate was
successfully recolored at one level, and the next recoloring candidate
was unsuccessful, we would not roll back the first candidates
successful recoloring. The forgotten successful recoloring may have
been assigned to something that conflicts with a register that needs
to be restored in a parent recoloring attempt.

      

See the testcase added in issue48473 for a more concrete example with
explanation.


https://reviews.llvm.org/D122580

Files:
  llvm/lib/CodeGen/RegAllocGreedy.cpp
  llvm/lib/CodeGen/RegAllocGreedy.h
  llvm/test/CodeGen/AMDGPU/issue48473.mir
  llvm/test/CodeGen/AMDGPU/regalloc-failure-overlapping-insert-assert.mir
  llvm/test/CodeGen/RISCV/regalloc-last-chance-recoloring-failure.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122580.418560.patch
Type: text/x-patch
Size: 24409 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220328/af1a0d79/attachment.bin>


More information about the llvm-commits mailing list