[regalloc] Do not pick state from ranges end before the predecessor does

When pick state from predecessor, we should consider live ranges that were split out by the backwards spilling heurisitics and already end before the predecessor does.

Bug: chromium:1066869
Change-Id: I9ff85e73059a7c07f1e212fdc041450c79a4d70c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2174337
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Commit-Queue: Yolanda Chen <yolanda.chen@intel.com>
Cr-Commit-Position: refs/heads/master@{#67665}
This commit is contained in:
Yolanda Chen 2020-05-06 23:18:54 +08:00 committed by Commit Bot
parent 1d8d67426e
commit f2fe2c678d

View File

@ -3848,11 +3848,15 @@ void LinearScanAllocator::AllocateRegisters() {
auto& spill_state = data()->GetSpillState(pred);
TRACE("Not a fallthrough. Adding %zu elements...\n",
spill_state.size());
LifetimePosition pred_end =
LifetimePosition::GapFromInstructionIndex(
this->code()->InstructionBlockAt(pred)->code_end());
for (const auto range : spill_state) {
// Filter out ranges that had their register stolen by backwards
// working spill heuristics. These have been spilled after the
// fact, so ignore them.
if (!range->HasRegisterAssigned()) continue;
// Filter out ranges that were split or had their register
// stolen by backwards working spill heuristics. These have
// been spilled after the fact, so ignore them.
if (range->End() < pred_end || !range->HasRegisterAssigned())
continue;
to_be_live->emplace(range);
}
}