[Liftoff] Fix redundant register moves
Moving a register to itself is not only unnecessary overhead, it also breaks invariants in the StackTransferRecipe. R=ahaas@chromium.org Bug: v8:6600, chromium:793551 Change-Id: I659fd66b4f2d4564c437ed9fb048322af4299d97 Reviewed-on: https://chromium-review.googlesource.com/819231 Reviewed-by: Clemens Hammacher <clemensh@chromium.org> Reviewed-by: Andreas Haas <ahaas@chromium.org> Commit-Queue: Clemens Hammacher <clemensh@chromium.org> Cr-Commit-Position: refs/heads/master@{#49992}
This commit is contained in:
parent
5d9683ee85
commit
9678c5320d
@ -158,7 +158,7 @@ class StackTransferRecipe {
|
||||
break;
|
||||
case VarState::kRegister:
|
||||
DCHECK_EQ(dst.reg_class(), src.reg_class());
|
||||
MoveRegister(dst, src.reg());
|
||||
if (dst != src.reg()) MoveRegister(dst, src.reg());
|
||||
break;
|
||||
case VarState::kConstant:
|
||||
LoadConstant(dst, WasmValue(src.i32_const()));
|
||||
@ -167,6 +167,7 @@ class StackTransferRecipe {
|
||||
}
|
||||
|
||||
void MoveRegister(LiftoffRegister dst, LiftoffRegister src) {
|
||||
DCHECK_NE(dst, src);
|
||||
DCHECK(!move_dst_regs.has(dst));
|
||||
move_dst_regs.set(dst);
|
||||
move_src_regs.set(src);
|
||||
|
20
test/mjsunit/regress/wasm/regress-793551.js
Normal file
20
test/mjsunit/regress/wasm/regress-793551.js
Normal file
@ -0,0 +1,20 @@
|
||||
// Copyright 2017 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.
|
||||
|
||||
load('test/mjsunit/wasm/wasm-constants.js');
|
||||
load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
|
||||
const builder = new WasmModuleBuilder();
|
||||
builder.addFunction('test', kSig_i_i)
|
||||
.addBody([
|
||||
// body:
|
||||
kExprGetLocal, 0, // get_local 0
|
||||
kExprGetLocal, 0, // get_local 0
|
||||
kExprLoop, kWasmStmt, // loop
|
||||
kExprBr, 0, // br depth=0
|
||||
kExprEnd, // end
|
||||
kExprUnreachable, // unreachable
|
||||
])
|
||||
.exportFunc();
|
||||
builder.instantiate();
|
Loading…
Reference in New Issue
Block a user