Commit 13436edc authored by Ross McIlroy's avatar Ross McIlroy Committed by Commit Bot

[TurboProp] Handle allocation of phis which are never used

In certain situations a phi might not be used by later code, and so
is neither spilled nor has a register allocated to it. Handle this
by removing the incorrect DCHECK.

BUG=chromium:1137979,v8:9684

Change-Id: I702dc05dba22e23dac5c1a366a770f18bac45c52
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2471998
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Auto-Submit: Ross McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70536}
parent 6227c95e
......@@ -2443,8 +2443,12 @@ void SinglePassRegisterAllocator::AllocatePhi(int virtual_register,
SpillRegisterForVirtualRegister(virtual_register);
} else {
RegisterIndex reg = RegisterForVirtualRegister(virtual_register);
DCHECK(reg.is_valid());
register_state()->UseForPhiGapMove(reg);
if (reg.is_valid()) {
// If the register is valid, assign it as a phi gap move to be processed
// at the successor blocks. If no register or spill slot was used then
// the virtual register was never used.
register_state()->UseForPhiGapMove(reg);
}
}
}
......
// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax --turboprop --no-lazy-feedback-allocation
// Flags: --noanalyze-environment-liveness
function foo() {
try {
bar();
} catch (e) {}
for (var i = 0; i < 3; i++) {
try {
%PrepareFunctionForOptimization(foo);
%OptimizeOsr();
} catch (e) {}
}
}
foo();
foo();
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