Commit 91a2ea81 authored by bmeurer's avatar bmeurer Committed by Commit bot

[turbofan] We never use Int64Constant for branch/select conditions.

Remove dead code to optimize Int64Constants as branch/select conditions,
because we either have tagged booleans or bits represented as word32.

R=jarin@chromium.org

Review-Url: https://codereview.chromium.org/1994533002
Cr-Commit-Position: refs/heads/master@{#36308}
parent b8fe4b0f
......@@ -27,10 +27,6 @@ Decision DecideCondition(Node* const cond) {
Int32Matcher mcond(cond);
return mcond.Value() ? Decision::kTrue : Decision::kFalse;
}
case IrOpcode::kInt64Constant: {
Int64Matcher mcond(cond);
return mcond.Value() ? Decision::kTrue : Decision::kFalse;
}
case IrOpcode::kHeapConstant: {
HeapObjectMatcher mcond(cond);
return mcond.Value()->BooleanValue() ? Decision::kTrue : Decision::kFalse;
......
......@@ -105,40 +105,6 @@ TEST_F(CommonOperatorReducerTest, BranchWithInt32OneConstant) {
}
TEST_F(CommonOperatorReducerTest, BranchWithInt64ZeroConstant) {
TRACED_FOREACH(BranchHint, hint, kBranchHints) {
Node* const control = graph()->start();
Node* const branch =
graph()->NewNode(common()->Branch(hint), Int64Constant(0), control);
Node* const if_true = graph()->NewNode(common()->IfTrue(), branch);
Node* const if_false = graph()->NewNode(common()->IfFalse(), branch);
StrictMock<MockAdvancedReducerEditor> editor;
EXPECT_CALL(editor, Replace(if_true, IsDead()));
EXPECT_CALL(editor, Replace(if_false, control));
Reduction const r = Reduce(&editor, branch);
ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(), IsDead());
}
}
TEST_F(CommonOperatorReducerTest, BranchWithInt64OneConstant) {
TRACED_FOREACH(BranchHint, hint, kBranchHints) {
Node* const control = graph()->start();
Node* const branch =
graph()->NewNode(common()->Branch(hint), Int64Constant(1), control);
Node* const if_true = graph()->NewNode(common()->IfTrue(), branch);
Node* const if_false = graph()->NewNode(common()->IfFalse(), branch);
StrictMock<MockAdvancedReducerEditor> editor;
EXPECT_CALL(editor, Replace(if_true, control));
EXPECT_CALL(editor, Replace(if_false, IsDead()));
Reduction const r = Reduce(&editor, branch);
ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(), IsDead());
}
}
TEST_F(CommonOperatorReducerTest, BranchWithFalseConstant) {
TRACED_FOREACH(BranchHint, hint, kBranchHints) {
Node* const control = graph()->start();
......@@ -500,30 +466,6 @@ TEST_F(CommonOperatorReducerTest, SelectWithInt32OneConstant) {
}
TEST_F(CommonOperatorReducerTest, SelectWithInt64ZeroConstant) {
Node* p0 = Parameter(0);
Node* p1 = Parameter(1);
Node* select =
graph()->NewNode(common()->Select(MachineRepresentation::kTagged),
Int64Constant(0), p0, p1);
Reduction r = Reduce(select);
ASSERT_TRUE(r.Changed());
EXPECT_EQ(p1, r.replacement());
}
TEST_F(CommonOperatorReducerTest, SelectWithInt64OneConstant) {
Node* p0 = Parameter(0);
Node* p1 = Parameter(1);
Node* select =
graph()->NewNode(common()->Select(MachineRepresentation::kTagged),
Int64Constant(1), p0, p1);
Reduction r = Reduce(select);
ASSERT_TRUE(r.Changed());
EXPECT_EQ(p0, r.replacement());
}
TEST_F(CommonOperatorReducerTest, SelectWithFalseConstant) {
Node* p0 = Parameter(0);
Node* p1 = Parameter(1);
......
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