[PATCH] D98766: [RegAlloc] Fix "ran out of regs" with uses in statepoint

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 17 17:30:49 PDT 2021


reames added a comment.

LGTM w/comments address.  Please hold submit for a couple of days for other reviewers to comment if desired.

For those reading along, Serguei and I have talked about alternatives extensively in offline discussion.  I really wanted a patch which could be generic (i.e. not specific to statepoints here), but every variant we tried hit either crashes or infinite loops in the register allocator.  The "basic" register allocator in particular is extraordinarily sensitive to this piece of code and relies on short live ranges being marked not spillable for forward progress.  I view this patch as a workaround rather than a true fix, but I can't continue to block a workaround without an idea of how to fix something the "right way".

The risk with this patch is that the register allocator may fail to make progress on the short live range intervals.  When exploring offline (with a variant, of a variant, of a variant of this patch), I saw at least one case where allowing the registers created by spiltting to be assigned normally seemed to cause an infinite split loop.  I'd traced that one far enough to be reasonably convinced it was simply a latent bug in last chance recoloring, but am not sure of my diagnosis.



================
Comment at: llvm/include/llvm/CodeGen/CalcSpillWeights.h:53
 
+    /// Returns true if Reg of live interval LI is used in instruction with many
+    /// operands like STATEPOINT. If we mark such interval as not spillable we
----------------
This comment tries to explain too much and is simply confusing.  I'd describe what this function does here, and then the purpose at the call site.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98766/new/

https://reviews.llvm.org/D98766



More information about the llvm-commits mailing list