Commit 7f054679 authored by Seth Brenith's avatar Seth Brenith Committed by Commit Bot

[regalloc] Run SpillPlacer on any value defined in a loop

I previously wrote a comment that said "We haven't seen any indication
of performance improvements from seeking optimal spilling positions
except on loop-top phi values". That statement is no longer true, now
that I've looked a little harder. In the latest version of the Mono
interpreter, we can improve performance by 2.5% by enabling SpillPlacer
for any value defined within a loop.

Bug: v8:10606
Change-Id: I25e06458c87ad4ffcefe52be3042032e05a47b35
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2381557Reviewed-by: 's avatarThibaud Michaud <thibaudm@chromium.org>
Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#69646}
parent 42fcb2c2
......@@ -1430,6 +1430,7 @@ class V8_EXPORT_PRIVATE InstructionBlock final
return loop_end_;
}
inline bool IsLoopHeader() const { return loop_end_.IsValid(); }
bool IsInLoop() const { return IsLoopHeader() || loop_header().IsValid(); }
inline bool IsSwitchTarget() const { return switch_target_; }
inline bool ShouldAlign() const { return alignment_; }
......
......@@ -40,12 +40,12 @@ void SpillPlacer::Add(TopLevelLiveRange* range) {
// the earliest deferred block as the insertion point would cause
// incorrect behavior, so the value must be spilled at the definition.
// - We haven't seen any indication of performance improvements from seeking
// optimal spilling positions except on loop-top phi values, so spill
// any value that isn't a loop-top phi at the definition to avoid
// increasing the code size for no benefit.
// optimal spilling positions for values defined outside loops, so spill
// those values at the definition to avoid increasing the code size for no
// benefit.
if (range->GetSpillMoveInsertionLocations(data()) == nullptr ||
range->spilled() || top_start_block->IsDeferred() ||
(!FLAG_stress_turbo_late_spilling && !range->is_loop_phi())) {
(!FLAG_stress_turbo_late_spilling && !top_start_block->IsInLoop())) {
range->CommitSpillMoves(data(), spill_operand);
return;
}
......
......@@ -562,7 +562,7 @@ DEFINE_BOOL(turbo_control_flow_aware_allocation, true,
"consider control flow while allocating registers")
DEFINE_BOOL(
stress_turbo_late_spilling, false,
"optimize placement of all spill instructions, not just loop-top phis")
"optimize placement of all spill instructions, not just loop values")
DEFINE_STRING(turbo_filter, "*", "optimization filter for TurboFan compiler")
DEFINE_BOOL(trace_turbo, false, "trace generated TurboFan IR")
......
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