[turbofan] Remove ineffective optimization from ControlReducer.
authorbmeurer <bmeurer@chromium.org>
Wed, 17 Jun 2015 06:11:40 +0000 (23:11 -0700)
committerCommit bot <commit-bot@chromium.org>
Wed, 17 Jun 2015 06:11:55 +0000 (06:11 +0000)
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}

src/compiler/control-reducer.cc
test/unittests/compiler/control-reducer-unittest.cc

index ef2e7f6..05cf5ec 100644 (file)
@@ -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;
   }
 
index d99548d..053ece0 100644 (file)
@@ -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;