[maglev] Avoid superfluous gap-moves at loops headers

Maglev's regalloc currently fills up registers with values it has on any
side of a branch; pulling the value from the stack on the other side.
This causes values that are live at the end of loops to be unspilled
before loops if they weren't already in that register. This is never
useful.

Bug: v8:7700
Change-Id: I120f3b351ea9919e450f8528a118191692e8cffd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4197337
Auto-Submit: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#85494}
This commit is contained in:
Toon Verwaest 2023-01-26 13:16:03 +01:00 committed by V8 LUCI CQ
parent 368216e3a3
commit 6112703014

View File

@ -1936,7 +1936,10 @@ void StraightForwardRegisterAllocator::MergeRegisterValues(ControlNode* control,
return;
}
if (node != nullptr && !node->is_loadable() && !node->has_register()) {
if (node == nullptr) {
// Don't load new nodes at loop headers.
if (control->Is<JumpLoop>()) return;
} else if (!node->is_loadable() && !node->has_register()) {
// If we have a node already, but can't load it here, we must be in a
// liveness hole for it, so nuke the merge state.
// This can only happen for conversion nodes, as they can split and take