[llvm] r228634 - Adjust how we avoid poll insertion inside the poll function (NFC)

Philip Reames listmail at philipreames.com
Mon Feb 9 16:04:53 PST 2015


Author: reames
Date: Mon Feb  9 18:04:53 2015
New Revision: 228634

URL: http://llvm.org/viewvc/llvm-project?rev=228634&view=rev
Log:
Adjust how we avoid poll insertion inside the poll function (NFC)

I realized that my early fix for this was overly complicated.  Rather than scatter checks around in a bunch of places, just exit early when we visit the poll function itself.

Thinking about it a bit, the whole inlining mechanism used with gc.safepoint_poll could probably be cleaned up a bit.  Originally, poll insertion was fused with gc relocation rewriting.  It might be worth going back to see if we can simplify the chain of events now that these two are seperated.  As one thought, maybe it makes sense to rewrite calls inside the helper function before inlining it to the many callers.  This would require us to visit the poll function before any other functions though..


Modified:
    llvm/trunk/lib/Transforms/Scalar/PlaceSafepoints.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/PlaceSafepoints.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/PlaceSafepoints.cpp?rev=228634&r1=228633&r2=228634&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/PlaceSafepoints.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/PlaceSafepoints.cpp Mon Feb  9 18:04:53 2015
@@ -509,6 +509,13 @@ bool PlaceSafepoints::runOnFunction(Func
     return false;
   }
 
+  if (isGCSafepointPoll(F)) {
+    // Given we're inlining this inside of safepoint poll insertion, this
+    // doesn't make any sense.  Note that we do make any contained calls
+    // parseable after we inline a poll.  
+    return false;
+  }
+
   bool modified = false;
 
   // In various bits below, we rely on the fact that uses are reachable from
@@ -527,14 +534,13 @@ bool PlaceSafepoints::runOnFunction(Func
 
   std::vector<CallSite> ParsePointNeeded;
 
-  if (EnableBackedgeSafepoints && !isGCSafepointPoll(F)) {
+  if (EnableBackedgeSafepoints) {
     // Construct a pass manager to run the LoopPass backedge logic.  We
     // need the pass manager to handle scheduling all the loop passes
     // appropriately.  Doing this by hand is painful and just not worth messing
     // with for the moment.
     FunctionPassManager FPM(F.getParent());
-    bool CanAssumeCallSafepoints = EnableCallSafepoints &&
-      !isGCSafepointPoll(F);
+    bool CanAssumeCallSafepoints = EnableCallSafepoints;
     PlaceBackedgeSafepointsImpl *PBS =
       new PlaceBackedgeSafepointsImpl(CanAssumeCallSafepoints);
     FPM.add(PBS);
@@ -601,7 +607,7 @@ bool PlaceSafepoints::runOnFunction(Func
     }
   }
 
-  if (EnableEntrySafepoints && !isGCSafepointPoll(F)) {
+  if (EnableEntrySafepoints) {
     DT.recalculate(F);
     Instruction *term = findLocationForEntrySafepoint(F, DT);
     if (!term) {
@@ -616,7 +622,7 @@ bool PlaceSafepoints::runOnFunction(Func
     }
   }
 
-  if (EnableCallSafepoints && !isGCSafepointPoll(F)) {
+  if (EnableCallSafepoints) {
     DT.recalculate(F);
     std::vector<CallSite> Calls;
     findCallSafepoints(F, Calls);





More information about the llvm-commits mailing list