Commit f050c53c authored by mtrofin's avatar mtrofin Committed by Commit bot

[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}
parent db646fb2
......@@ -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);
......
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment