Commit 78b5ff5b authored by Clemens Backes's avatar Clemens Backes Committed by V8 LUCI CQ

[compiler] Speed up mid-tier regalloc checks

This minor change in how we iterate the virtual registers speeds up the
consistency checks by a factor of more than four.

R=thibaudm@chromium.org

Bug: chromium:1271369
Change-Id: Ieb9640d52c84fabacbbcf0fea56825fb594cfc21
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3406759Reviewed-by: 's avatarThibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78738}
parent 94c17edb
...@@ -1949,10 +1949,9 @@ void SinglePassRegisterAllocator::UpdateVirtualRegisterState() { ...@@ -1949,10 +1949,9 @@ void SinglePassRegisterAllocator::UpdateVirtualRegisterState() {
void SinglePassRegisterAllocator::CheckConsistency() { void SinglePassRegisterAllocator::CheckConsistency() {
#ifdef DEBUG #ifdef DEBUG
for (int virtual_register = 0; int virtual_register = -1;
virtual_register < data_->code()->VirtualRegisterCount(); for (RegisterIndex reg : virtual_register_to_reg_) {
virtual_register++) { ++virtual_register;
RegisterIndex reg = RegisterForVirtualRegister(virtual_register);
if (!reg.is_valid()) continue; if (!reg.is_valid()) continue;
CHECK_NOT_NULL(register_state_); CHECK_NOT_NULL(register_state_);
// The register must be set to allocated. // The register must be set to allocated.
...@@ -1960,6 +1959,7 @@ void SinglePassRegisterAllocator::CheckConsistency() { ...@@ -1960,6 +1959,7 @@ void SinglePassRegisterAllocator::CheckConsistency() {
// reg <-> vreg linking is consistent. // reg <-> vreg linking is consistent.
CHECK_EQ(virtual_register, VirtualRegisterForRegister(reg)); CHECK_EQ(virtual_register, VirtualRegisterForRegister(reg));
} }
CHECK_EQ(data_->code()->VirtualRegisterCount() - 1, virtual_register);
RegisterBitVector used_registers; RegisterBitVector used_registers;
for (RegisterIndex reg : *register_state_) { for (RegisterIndex reg : *register_state_) {
......
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