[instruction-selector-x64] Fix bug in instruction selector

A node short-cutting optimization was not updating uses correctly. This
fix makes sure that there are no other users of the node, thus making the
use update unnecessary.

This fix might have negative performance implications.

Change-Id: Ie9bd23caf4434eb2137e111dc5e7c143fd97521c
Reviewed-on: https://chromium-review.googlesource.com/c/1299019
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57001}
This commit is contained in:
Sigurd Schneider 2018-10-25 18:17:44 +02:00 committed by Commit Bot
parent a34ef5cff8
commit 4fb20c9713

View File

@ -1671,10 +1671,15 @@ void VisitWordCompare(InstructionSelector* selector, Node* node,
// The 32-bit comparisons automatically truncate Word64
// values to Word32 range, no need to do that explicitly.
if (opcode == kX64Cmp32 || opcode == kX64Test32) {
while (left->opcode() == IrOpcode::kTruncateInt64ToInt32) {
if (left->opcode() == IrOpcode::kTruncateInt64ToInt32 &&
selector->CanCover(node, left) &&
selector->CanCover(left, left->InputAt(0))) {
left = left->InputAt(0);
}
while (right->opcode() == IrOpcode::kTruncateInt64ToInt32) {
if (right->opcode() == IrOpcode::kTruncateInt64ToInt32 &&
selector->CanCover(node, right) &&
selector->CanCover(right, right->InputAt(0))) {
right = right->InputAt(0);
}
}