summaryrefslogtreecommitdiff
path: root/deps/v8/src/compiler/common-operator-reducer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/compiler/common-operator-reducer.cc')
-rw-r--r--deps/v8/src/compiler/common-operator-reducer.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/deps/v8/src/compiler/common-operator-reducer.cc b/deps/v8/src/compiler/common-operator-reducer.cc
index 9527c754e4..c5ced20373 100644
--- a/deps/v8/src/compiler/common-operator-reducer.cc
+++ b/deps/v8/src/compiler/common-operator-reducer.cc
@@ -77,8 +77,12 @@ Reduction CommonOperatorReducer::ReduceBranch(Node* node) {
// Swap IfTrue/IfFalse on {branch} if {cond} is a BooleanNot and use the input
// to BooleanNot as new condition for {branch}. Note we assume that {cond} was
// already properly optimized before we get here (as guaranteed by the graph
- // reduction logic).
- if (cond->opcode() == IrOpcode::kBooleanNot) {
+ // reduction logic). The same applies if {cond} is a Select acting as boolean
+ // not (i.e. true being returned in the false case and vice versa).
+ if (cond->opcode() == IrOpcode::kBooleanNot ||
+ (cond->opcode() == IrOpcode::kSelect &&
+ DecideCondition(cond->InputAt(1)) == Decision::kFalse &&
+ DecideCondition(cond->InputAt(2)) == Decision::kTrue)) {
for (Node* const use : node->uses()) {
switch (use->opcode()) {
case IrOpcode::kIfTrue: