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

Unified Diff: src/compiler/branch-elimination.cc

Issue 2617123002: [turbofan] Allow indexed access to node inputs/input_edges (Closed)
Patch Set: Revert AST graph builder change Created 3 years, 11 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 | « no previous file | src/compiler/bytecode-graph-builder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/branch-elimination.cc
diff --git a/src/compiler/branch-elimination.cc b/src/compiler/branch-elimination.cc
index e6714405aa8153227000d3c99325e06643f519fa..0b7ad19af759012cd82a682b9f62674aabed9f3d 100644
--- a/src/compiler/branch-elimination.cc
+++ b/src/compiler/branch-elimination.cc
@@ -145,20 +145,27 @@ Reduction BranchElimination::ReduceLoop(Node* node) {
Reduction BranchElimination::ReduceMerge(Node* node) {
// Shortcut for the case when we do not know anything about some
// input.
- for (Node* input : node->inputs()) {
+ Node::Inputs inputs = node->inputs();
+ for (Node* input : inputs) {
if (node_conditions_.Get(input) == nullptr) {
return UpdateConditions(node, nullptr);
}
}
- const ControlPathConditions* first = node_conditions_.Get(node->InputAt(0));
+ auto input_it = inputs.begin();
+
+ DCHECK_GT(inputs.count(), 0);
+
+ const ControlPathConditions* first = node_conditions_.Get(*input_it);
+ ++input_it;
// Make a copy of the first input's conditions and merge with the conditions
// from other inputs.
ControlPathConditions* conditions =
new (zone_->New(sizeof(ControlPathConditions)))
ControlPathConditions(*first);
- for (int i = 1; i < node->InputCount(); i++) {
- conditions->Merge(*(node_conditions_.Get(node->InputAt(i))));
+ auto input_end = inputs.end();
+ for (; input_it != input_end; ++input_it) {
+ conditions->Merge(*(node_conditions_.Get(*input_it)));
}
return UpdateConditions(node, conditions);
« no previous file with comments | « no previous file | src/compiler/bytecode-graph-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698