[PATCH] D15982: [rs4gc] Optionally directly relocated vector of pointers

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 7 16:37:36 PST 2016


reames created this revision.
reames added reviewers: pgavlin, JosephTremoulet, sanjoy, mjacob.
reames added a subscriber: llvm-commits.
Herald added a subscriber: sanjoy.

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 disable use "-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.  

http://reviews.llvm.org/D15982

Files:
  lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
  test/Transforms/RewriteStatepointsForGC/deopt-bundles/live-vector-nosplit.ll
  test/Transforms/RewriteStatepointsForGC/deopt-bundles/live-vector.ll
  test/Transforms/RewriteStatepointsForGC/live-vector.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15982.44290.patch
Type: text/x-patch
Size: 8068 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160108/50d541ab/attachment.bin>


More information about the llvm-commits mailing list