[PATCH] D37578: [RegAlloc] Keep a copy of live interval for the spilled vregs in HoistSpillHelper

Wei Mi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 7 11:29:11 PDT 2017


wmi created this revision.
Herald added subscribers: eraman, sanjoy.

This is to fix PR34502. After https://reviews.llvm.org/rL311401, the live range of spilled vreg will be cleared. HoistSpill need to use the live range of the original vreg before splitting to know the moving range of the spills. The patch saves a copy of live interval for the spilled vreg inside of HoistSpillHelper.

However, it sounds the problem should have been exposed earlier and been more widespread. This bug doesn't happen that often because if the original vreg is spilled, the spill will be generated after its def so no hoisting is needed. Only when the vreg generated from split (i.e., not the original vreg) is spilled, hoisting may be needed, and in that case the live interval of the original vreg will still be there.  PR34502 triggered the problem in a very rare way -- after original vreg was spilled, the related valnos vector inside of its live range was released, and it caused some inconsistent state of MergeableSpills map (The map uses valno as its index) and introduced a spill not belonging to the original vreg at all. I didn't successfully create a similar testcase by hand. I am not sure whether we want to add the testcase from PR34502 because it is still a large test after using bugpoint and I believe the check will be in vain quickly since it only happened to trigger the problem.


Repository:
  rL LLVM

https://reviews.llvm.org/D37578

Files:
  lib/CodeGen/InlineSpiller.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37578.114208.patch
Type: text/x-patch
Size: 6689 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170907/a354c51c/attachment.bin>


More information about the llvm-commits mailing list