[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:
parent
db646fb2f8
commit
f050c53c9a
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user