[rs4gc] Optionally directly relocated vector of pointers
authorPhilip Reames <listmail@philipreames.com>
Sat, 9 Jan 2016 01:31:13 +0000 (01:31 +0000)
committerPhilip Reames <listmail@philipreames.com>
Sat, 9 Jan 2016 01:31:13 +0000 (01:31 +0000)
commit4d97f61b53432e9b87112cedc45509a5a3b8ff38
tree7b856c4c270e33ff23b6c2403fcf0379f4367075
parent461ac91112c31d52c93bc9c5bd47d33df4c842a0
[rs4gc] Optionally directly relocated vector of pointers

This patch teaches rewrite-statepoints-for-gc to relocate vector-of-pointers directly rather than trying to split them. This builds on the recent lowering/IR changes to allow vector typed gc.relocates.

The motivation for this is that we recently found a bug in the vector splitting code where depending on visit order, a vector might not be relocated at some safepoint. Specifically, the bug is that the splitting code wasn't updating the side tables (live vector) of other safepoints. As a result, a vector which was live at two safepoints might not be updated at one of them. However, if you happened to visit safepoints in post order over the dominator tree, everything worked correctly. Weirdly, it turns out that post order is actually an incredibly common order to visit instructions in in practice. Frustratingly, I have not managed to write a test case which actually hits this. I can only reproduce it in large IR files produced by actual applications.

Rather than continue to make this code more complicated, we can remove all of the complexity by just representing the relocation of the entire vector natively in the IR.

At the moment, the new functionality is hidden behind a flag. To use this code, you need to pass "-rs4gc-split-vector-values=0". Once I have a chance to stress test with this option and get feedback from other users, my plan is to flip the default and remove the original splitting code. I would just remove it now, but given the rareness of the bug, I figured it was better to leave it in place until the new approach has been stress tested.

Differential Revision: http://reviews.llvm.org/D15982

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257244 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
test/Transforms/RewriteStatepointsForGC/deopt-bundles/live-vector-nosplit.ll [new file with mode: 0644]
test/Transforms/RewriteStatepointsForGC/deopt-bundles/live-vector.ll
test/Transforms/RewriteStatepointsForGC/live-vector.ll