[PATCH] [PlaceSafepoints] Use the analysis infrastructure rather than an inner pass manager

Philip Reames listmail at philipreames.com
Wed May 13 12:11:08 PDT 2015


Hi sanjoy, igor-laevsky, AndyAyers, pgavlin, hfinkel, rkotler,

I would really appreciate careful review on the analysis update logic in the newly added function.

PlaceSafepoints was previously using an inner pass manager to run an analysis pass *after* modifying the IR to remove unreachable blocks.  In an effort to get rid of the inner pass manager (and the various dominator tree recalcs it implied), I switched to using the analysis infrastructure to actually get the various analysis needed and convert the inner pass manager stuff into a small non-pass helper class.  

However, I couldn't figure out how to keep the analysis results up to date over a call to removeUnreachableBlocks.  That routine freely modifies the CFG in non-trivial ways with no provisions for updating any of dominator tree, or loop info.  Instead, I introduced a new helper function which *only* removes blocks which aren't reachable from the function entry according to the dominator tree.  This version supports analysis updating for DT, LI, and (implicitly) SE.  

After making the change for PlaceSafepoints, I noticed that RewriteSafepointsForGC had a related invalidation bug.  If there was an unreachable statepoint, the analysis results were out of sync with the function being processed after unreachable code was removed.  

I suspect - but have not investigated in great depth - that other callers of removeUnreachableBlocks might have similar invalidation bugs.  In particular, I'm extremely suspicious of CodeGen/WinEHPrepare.

http://reviews.llvm.org/D9761

Files:
  include/llvm/Transforms/Utils/Local.h
  lib/Transforms/Scalar/PlaceSafepoints.cpp
  lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
  lib/Transforms/Scalar/Scalar.cpp
  lib/Transforms/Utils/Local.cpp

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9761.25721.patch
Type: text/x-patch
Size: 10368 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150513/d96b093c/attachment.bin>


More information about the llvm-commits mailing list