[PATCH] D41098: [InlineSpiller] Fix a crash due to lack of forward progress from remat

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 19 14:32:40 PDT 2018


reames added a comment.

I went ahead and submitted the workaround, but I want to record one other idea I tried.  It didn't work out, but I'm not sure if that's due to something fundamental, or if I just had a non-obvious bug.

I explored introducing another step in RegAllocGreedy's LiveRangeStage after RS_Spill called RS_SpillWithoutRemat.  The idea was that spilling transitioned the new vregs created not to RS_Done, but to the new state which allowed them to be spilled again if needed.  By avoiding remat, we should avoid infinite retry loops.  If we don't remat, then every reload use should be foldable into the STATEPOINT .  Given the existing remats might have fragmented live ranges, we might end up with awful spill, reload, spill, fold patterns, but in theory it should always work.

Another framing would be to split out RS_Remat as a distinct phase before either splitting or spilling.  At the moment, we have two different sets of remat logic (in splitting and spilling respectively), so I didn't want to pursue that approach since there might be lots of perturbation of the output.  I also wasn't quite sure how the queue order would impact code quality if we rematted, and then defered spilling until other vregs had been processed.


Repository:
  rL LLVM

https://reviews.llvm.org/D41098





More information about the llvm-commits mailing list