Commit ad6e7391 authored by bmeurer's avatar bmeurer Committed by Commit bot

[turbofan] Remove ineffective optimization from ControlReducer.

This optimization just duplicates part of the ToBoolean rule in the
Typer, and it doesn't make sense to have adhoc partial typing rules in
the ControlReducer anyway.

R=jarin@chromium.org

Review URL: https://codereview.chromium.org/1189963002

Cr-Commit-Position: refs/heads/master@{#29064}
parent 9b62bb32
......@@ -212,11 +212,6 @@ class ControlReducerImpl final : public AdvancedReducer {
default:
break;
}
if (NodeProperties::IsTyped(cond)) {
// If the node has a range type, check whether the range excludes 0.
Type* type = NodeProperties::GetBounds(cond).upper;
if (type->IsRange() && (type->Min() > 0 || type->Max() < 0)) return kTrue;
}
return kUnknown;
}
......
......@@ -145,52 +145,6 @@ TEST_F(ControlReducerTest, PhiAsInputToBranch_unknown_true) {
}
TEST_F(ControlReducerTest, RangeAsInputToBranch_true1) {
Node* p0 = Parameter(Type::Range(1, 2, zone()), 0);
Node* branch1 = graph()->NewNode(common()->Branch(), p0, graph()->start());
Node* if_true1 = graph()->NewNode(common()->IfTrue(), branch1);
Node* if_false1 = graph()->NewNode(common()->IfFalse(), branch1);
Node* merge1 = graph()->NewNode(common()->Merge(1), if_true1, if_false1);
Node* result = graph()->NewNode(common()->Phi(kMachInt32, 2),
jsgraph()->Int32Constant(11),
jsgraph()->Int32Constant(44), merge1);
Node* ret =
graph()->NewNode(common()->Return(), result, graph()->start(), merge1);
graph()->end()->ReplaceInput(0, ret);
ReduceGraph();
// Diamond should be folded away.
EXPECT_THAT(
graph()->end(),
IsEnd(IsReturn(IsInt32Constant(11), graph()->start(), graph()->start())));
}
TEST_F(ControlReducerTest, RangeAsInputToBranch_true2) {
Node* p0 = Parameter(Type::Range(-2, -1, zone()), 0);
Node* branch1 = graph()->NewNode(common()->Branch(), p0, graph()->start());
Node* if_true1 = graph()->NewNode(common()->IfTrue(), branch1);
Node* if_false1 = graph()->NewNode(common()->IfFalse(), branch1);
Node* merge1 = graph()->NewNode(common()->Merge(1), if_true1, if_false1);
Node* result = graph()->NewNode(common()->Phi(kMachInt32, 2),
jsgraph()->Int32Constant(11),
jsgraph()->Int32Constant(44), merge1);
Node* ret =
graph()->NewNode(common()->Return(), result, graph()->start(), merge1);
graph()->end()->ReplaceInput(0, ret);
ReduceGraph();
// Diamond should be folded away.
EXPECT_THAT(
graph()->end(),
IsEnd(IsReturn(IsInt32Constant(11), graph()->start(), graph()->start())));
}
TEST_F(ControlReducerTest, SelectPhi) {
Node* p0 = Parameter(0);
const MachineType kType = kMachInt32;
......
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