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
This commit is contained in:
Philip Reames 2015-02-10 00:04:53 +00:00
parent c0cd86712c
commit 2fc495a300

View File

@ -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<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(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<CallSite> Calls;
findCallSafepoints(F, Calls);