Index: test/unittests/compiler/common-operator-reducer-unittest.cc |
diff --git a/test/unittests/compiler/common-operator-reducer-unittest.cc b/test/unittests/compiler/common-operator-reducer-unittest.cc |
index f51a54d074c96cc141fc9378a213a708a080f1ec..d28477239535b9ebce60ec6c28206969bbd0c719 100644 |
--- a/test/unittests/compiler/common-operator-reducer-unittest.cc |
+++ b/test/unittests/compiler/common-operator-reducer-unittest.cc |
@@ -158,6 +158,26 @@ TEST_F(CommonOperatorReducerTest, BranchWithBooleanNot) { |
} |
} |
+TEST_F(CommonOperatorReducerTest, BranchWithSelect) { |
+ Node* const value = Parameter(0); |
+ TRACED_FOREACH(BranchHint, hint, kBranchHints) { |
+ Node* const control = graph()->start(); |
+ Node* const branch = graph()->NewNode( |
+ common()->Branch(hint), |
+ graph()->NewNode(common()->Select(MachineRepresentation::kTagged), |
+ value, FalseConstant(), TrueConstant()), |
+ control); |
+ Node* const if_true = graph()->NewNode(common()->IfTrue(), branch); |
+ Node* const if_false = graph()->NewNode(common()->IfFalse(), branch); |
+ Reduction const r = Reduce(branch); |
+ ASSERT_TRUE(r.Changed()); |
+ EXPECT_EQ(branch, r.replacement()); |
+ EXPECT_THAT(branch, IsBranch(value, control)); |
+ EXPECT_THAT(if_false, IsIfTrue(branch)); |
+ EXPECT_THAT(if_true, IsIfFalse(branch)); |
+ EXPECT_EQ(NegateBranchHint(hint), BranchHintOf(branch->op())); |
+ } |
+} |
// ----------------------------------------------------------------------------- |
// Merge |