Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(390)

Unified Diff: src/compiler/select-lowering.cc

Issue 1870763003: [turbofan] Remove some clever-but-wrong bits from select lowering. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Update (= remove) the test Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/select-lowering.h ('k') | test/mjsunit/compiler/regress-600593.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/select-lowering.cc
diff --git a/src/compiler/select-lowering.cc b/src/compiler/select-lowering.cc
index e5d86c28f0c09bf378086f3892aa3fc5be1281bb..b1a230962fd511aca828838a198cbf60df21ff97 100644
--- a/src/compiler/select-lowering.cc
+++ b/src/compiler/select-lowering.cc
@@ -15,10 +15,7 @@ namespace internal {
namespace compiler {
SelectLowering::SelectLowering(Graph* graph, CommonOperatorBuilder* common)
- : common_(common),
- graph_(graph),
- merges_(Merges::key_compare(), Merges::allocator_type(graph->zone())) {}
-
+ : common_(common), graph_(graph) {}
SelectLowering::~SelectLowering() {}
@@ -30,58 +27,16 @@ Reduction SelectLowering::Reduce(Node* node) {
Node* cond = node->InputAt(0);
Node* vthen = node->InputAt(1);
Node* velse = node->InputAt(2);
- Node* merge = nullptr;
-
- // Check if we already have a diamond for this condition.
- auto range = merges_.equal_range(cond);
- for (auto i = range.first;; ++i) {
- if (i == range.second) {
- // Create a new diamond for this condition and remember its merge node.
- Diamond d(graph(), common(), cond, p.hint());
- merges_.insert(std::make_pair(cond, d.merge));
- merge = d.merge;
- break;
- }
-
- // If the diamond is reachable from the Select, merging them would result in
- // an unschedulable graph, so we cannot reuse the diamond in that case.
- merge = i->second;
- if (!ReachableFrom(merge, node)) {
- break;
- }
- }
- // Create a Phi hanging off the previously determined merge.
+ // Create a diamond and a phi.
+ Diamond d(graph(), common(), cond, p.hint());
node->ReplaceInput(0, vthen);
node->ReplaceInput(1, velse);
- node->ReplaceInput(2, merge);
+ node->ReplaceInput(2, d.merge);
NodeProperties::ChangeOp(node, common()->Phi(p.representation(), 2));
return Changed(node);
}
-
-bool SelectLowering::ReachableFrom(Node* const sink, Node* const source) {
- // TODO(turbofan): This is probably horribly expensive, and it should be moved
- // into node.h or somewhere else?!
- Zone zone(graph()->zone()->allocator());
- std::queue<Node*, NodeDeque> queue((NodeDeque(&zone)));
- BoolVector visited(graph()->NodeCount(), false, &zone);
- queue.push(source);
- visited[source->id()] = true;
- while (!queue.empty()) {
- Node* current = queue.front();
- if (current == sink) return true;
- queue.pop();
- for (auto input : current->inputs()) {
- if (!visited[input->id()]) {
- queue.push(input);
- visited[input->id()] = true;
- }
- }
- }
- return false;
-}
-
} // namespace compiler
} // namespace internal
} // namespace v8
« no previous file with comments | « src/compiler/select-lowering.h ('k') | test/mjsunit/compiler/regress-600593.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698