Commit 71a9fcc9 authored by Darius Mercadier's avatar Darius Mercadier Committed by V8 LUCI CQ

Revert "[compiler] let InstructionSelector duplicate branch conditions"

This reverts commit 3d5d99ff.

Reason for revert: causes this crash: https://bugs.chromium.org/p/chromium/issues/detail?id=1303458

Original change's description:
> [compiler] let InstructionSelector duplicate branch conditions
>
> Bug: v8:12484
> Change-Id: I44c2028efadbd70e7711f01d107995e0462f05d4
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3477094
> Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
> Commit-Queue: Darius Mercadier <dmercadier@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#79239}

Bug: chromium:1303458, v8:12484
Change-Id: I129467bcb2507f2fba894f5dd58304eb139f739c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3522069Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Darius Mercadier <dmercadier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79469}
parent dc9ed94e
......@@ -2479,28 +2479,6 @@ void VisitAtomicCompareExchange(InstructionSelector* selector, Node* node,
selector->Emit(code, arraysize(outputs), outputs, arraysize(inputs), inputs);
}
// Used instead of CanCover in VisitWordCompareZero: even if CanCover(user,
// node) returns false, if |node| is a comparison, then it does not require any
// registers, and can thus be covered by |user|.
bool CanCoverForCompareZero(InstructionSelector* selector, Node* user,
Node* node) {
if (selector->CanCover(user, node)) {
return true;
}
// Checking if |node| is a comparison. If so, it doesn't required any
// registers, and, as such, it can always be covered by |user|.
switch (node->opcode()) {
#define CHECK_CMP_OP(op) \
case IrOpcode::k##op: \
return true;
MACHINE_COMPARE_BINOP_LIST(CHECK_CMP_OP)
#undef CHECK_CMP_OP
default:
break;
}
return false;
}
} // namespace
// Shared routine for word comparison against zero.
......@@ -2516,7 +2494,7 @@ void InstructionSelector::VisitWordCompareZero(Node* user, Node* value,
cont->Negate();
}
if (CanCoverForCompareZero(this, user, value)) {
if (CanCover(user, value)) {
switch (value->opcode()) {
case IrOpcode::kWord32Equal:
cont->OverwriteAndNegateIfEqual(kEqual);
......@@ -2536,7 +2514,7 @@ void InstructionSelector::VisitWordCompareZero(Node* user, Node* value,
case IrOpcode::kWord64Equal: {
cont->OverwriteAndNegateIfEqual(kEqual);
Int64BinopMatcher m(value);
if (m.right().Is(0) && CanCover(user, value)) {
if (m.right().Is(0)) {
// Try to combine the branch with a comparison.
Node* const eq_user = m.node();
Node* const eq_value = m.left().node();
......@@ -2646,6 +2624,7 @@ void InstructionSelector::VisitWordCompareZero(Node* user, Node* value,
break;
}
}
// Branch could not be combined with a compare, emit compare against 0.
VisitCompareZero(this, user, value, kX64Cmp32, cont);
}
......
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