Revert "[compiler] let InstructionSelector duplicate branch conditions"
This reverts commit 3d5d99ffd9bd0dd433cfdf8ba9b207648ff51ea9.
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/+/3522069
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Commit-Queue: Darius Mercadier <dmercadier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79469}
diff --git a/src/compiler/backend/x64/instruction-selector-x64.cc b/src/compiler/backend/x64/instruction-selector-x64.cc
index 2cc4bef..a30b501 100644
--- a/src/compiler/backend/x64/instruction-selector-x64.cc
+++ b/src/compiler/backend/x64/instruction-selector-x64.cc
@@ -2479,28 +2479,6 @@
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 @@
cont->Negate();
}
- if (CanCoverForCompareZero(this, user, value)) {
+ if (CanCover(user, value)) {
switch (value->opcode()) {
case IrOpcode::kWord32Equal:
cont->OverwriteAndNegateIfEqual(kEqual);
@@ -2536,7 +2514,7 @@
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 @@
break;
}
}
+
// Branch could not be combined with a compare, emit compare against 0.
VisitCompareZero(this, user, value, kX64Cmp32, cont);
}