From 2fc495a300d19b5f294b32e7dde864a945bf2dbc Mon Sep 17 00:00:00 2001 From: Philip Reames Date: Tue, 10 Feb 2015 00:04:53 +0000 Subject: [PATCH] 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.. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228634 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/PlaceSafepoints.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/Transforms/Scalar/PlaceSafepoints.cpp b/lib/Transforms/Scalar/PlaceSafepoints.cpp index 7b10d543736..593e1a0d456 100644 --- a/lib/Transforms/Scalar/PlaceSafepoints.cpp +++ b/lib/Transforms/Scalar/PlaceSafepoints.cpp @@ -509,6 +509,13 @@ bool PlaceSafepoints::runOnFunction(Function &F) { 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(Function &F) { std::vector 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(Function &F) { } } - if (EnableEntrySafepoints && !isGCSafepointPoll(F)) { + if (EnableEntrySafepoints) { DT.recalculate(F); Instruction *term = findLocationForEntrySafepoint(F, DT); if (!term) { @@ -616,7 +622,7 @@ bool PlaceSafepoints::runOnFunction(Function &F) { } } - if (EnableCallSafepoints && !isGCSafepointPoll(F)) { + if (EnableCallSafepoints) { DT.recalculate(F); std::vector Calls; findCallSafepoints(F, Calls); -- 2.40.0