[turbofan] Split before loops.

If the range doesn't have calls, but still fails to allocate, try and find a split
position outside a loop.

BUG=

Review URL: https://codereview.chromium.org/1301393012

Cr-Commit-Position: refs/heads/master@{#30580}
This commit is contained in:
mtrofin 2015-09-04 01:28:00 -07:00 committed by Commit bot
parent db646fb2f8
commit f050c53c9a
2 changed files with 20 additions and 1 deletions

View File

@ -476,9 +476,25 @@ LifetimePosition GreedyAllocator::FindSplitPositionAfterCall(
}
LifetimePosition GreedyAllocator::FindSplitPositionBeforeLoops(
LiveRange* range) {
LifetimePosition end = range->End();
if (end.ToInstructionIndex() >= code()->LastInstructionIndex()) {
end =
LifetimePosition::GapFromInstructionIndex(end.ToInstructionIndex() - 1);
}
LifetimePosition pos = FindOptimalSplitPos(range->Start(), end);
pos = GetSplitPositionForInstruction(range, pos.ToInstructionIndex());
return pos;
}
void GreedyAllocator::SplitOrSpillBlockedRange(LiveRange* range) {
if (TrySplitAroundCalls(range)) return;
auto pos = GetLastResortSplitPosition(range, code());
LifetimePosition pos = FindSplitPositionBeforeLoops(range);
if (!pos.IsValid()) pos = GetLastResortSplitPosition(range, code());
if (pos.IsValid()) {
LiveRange* tail = Split(range, data(), pos);
DCHECK(tail != range);

View File

@ -132,6 +132,9 @@ class GreedyAllocator final : public RegisterAllocator {
// were made, or false if no calls were found.
bool TrySplitAroundCalls(LiveRange* range);
// Find a split position at the outmost loop.
LifetimePosition FindSplitPositionBeforeLoops(LiveRange* range);
// Finds the first call instruction in the path of this range. Splits before
// and requeues that segment (if any), spills the section over the call, and
// returns the section after the call. The return is: