Commit 1d9642d3 authored by mtrofin's avatar mtrofin Committed by Commit bot

[turbofan] Optimize Splinter by remembering where it left off.

Splintering relies on DetachAt, which in turn relies on
FirstSearchIntervalForPosition to find the first UseInterval
to split, given a position. The later API (Find...) has an
optimization for linear traversals. Splintering traverses
linearly (block by block), so we leverage the same
optimization by moving current_interval_ forward.

(Also added an unrelated TODO.)

BUG=chromium:524880
LOG=n

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

Cr-Commit-Position: refs/heads/master@{#30456}
parent fef4fab6
......@@ -825,6 +825,12 @@ void TopLevelLiveRange::Splinter(LifetimePosition start, LifetimePosition end,
result->set_spill_type(spill_type());
if (start <= Start()) {
// TODO(mtrofin): here, the TopLevel part is in the deferred range, so we
// may want to continue processing the splinter. However, if the value is
// defined in a cold block, and then used in a hot block, it follows that
// it should terminate on the RHS of a phi, defined on the hot path. We
// should check this, however, this may not be the place, because we don't
// have access to the instruction sequence.
DCHECK(end < End());
DetachAt(end, result, zone);
next_ = nullptr;
......@@ -844,6 +850,10 @@ void TopLevelLiveRange::Splinter(LifetimePosition start, LifetimePosition end,
next_ = end_part.next_;
last_interval_->set_next(end_part.first_interval_);
// The next splinter will happen either at or after the current interval.
// We can optimize DetachAt by setting current_interval_ accordingly,
// which will then be picked up by FirstSearchIntervalForPosition.
current_interval_ = last_interval_;
last_interval_ = end_part.last_interval_;
......
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