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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 10698153: Change comparison-to-branch fusion to actually remove comparison from the graph. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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 | « runtime/vm/flow_graph_compiler.cc ('k') | runtime/vm/il_printer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_optimizer.cc
diff --git a/runtime/vm/flow_graph_optimizer.cc b/runtime/vm/flow_graph_optimizer.cc
index a02a048f50c3c75d750092c4c44fcd1c185e0c58..e36936b218e892c270ec33163088974f92d19020 100644
--- a/runtime/vm/flow_graph_optimizer.cc
+++ b/runtime/vm/flow_graph_optimizer.cc
@@ -527,6 +527,8 @@ void FlowGraphOptimizer::VisitStoreIndexed(StoreIndexedComp* comp,
}
+
+
static void TryFuseComparisonWithBranch(BindInstr* instr,
ComparisonComp* comp) {
Instruction* next_instr = instr->next();
@@ -535,7 +537,11 @@ static void TryFuseComparisonWithBranch(BindInstr* instr,
UseVal* use = branch->value()->AsUse();
if (instr == use->definition()) {
comp->MarkFusedWithBranch(branch);
- branch->MarkFusedWithComparison();
+ branch->MarkFusedWithComparison(comp);
+
+ // Remove comparison from the graph.
+ branch->set_previous(instr->previous());
+ instr->previous()->set_next(branch);
srdjan 2012/07/11 16:19:38 How about factoring this out into a Remove method?
Vyacheslav Egorov (Google) 2012/07/11 17:30:26 It can't be factored into generic remove method be
return;
}
}
@@ -549,9 +555,12 @@ static void TryFuseComparisonWithBranch(BindInstr* instr,
if ((branch->value()->AsUse()->definition() == next_instr) &&
(negate->value()->AsUse()->definition() == instr)) {
comp->MarkFusedWithBranch(branch);
- branch->MarkFusedWithComparison();
+ branch->MarkFusedWithComparison(comp);
branch->set_is_negated(true);
- instr->set_next(next_next_instr);
+
+ // Remove comparison and boolean negation from the graph.
+ branch->set_previous(instr->previous());
+ instr->previous()->set_next(branch);
srdjan 2012/07/11 16:19:38 Ditto. Clear next/previous of branch and negate.
Vyacheslav Egorov (Google) 2012/07/11 17:30:26 Currently we fuse from inside visiting of comparis
return;
}
}
« no previous file with comments | « runtime/vm/flow_graph_compiler.cc ('k') | runtime/vm/il_printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698