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

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

Issue 2135123002: [turbofan] Eliminate a few redundant bounds checks. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix BranchElimination to play well with the other reducers. Created 4 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 | « no previous file | src/compiler/pipeline.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 236fbcad5f931f4bc460850fa7a288e02415a3a3..b1967b896a8b893ce3434fae876a22b67dc283ee 100644
--- a/src/compiler/branch-elimination.cc
+++ b/src/compiler/branch-elimination.cc
@@ -92,8 +92,7 @@ Reduction BranchElimination::ReduceDeoptimizeConditional(Node* node) {
// yet because we will have to recompute anyway once we compute the
// predecessor.
if (conditions == nullptr) {
- DCHECK_NULL(node_conditions_.Get(node));
- return NoChange();
+ return UpdateConditions(node, conditions);
}
Maybe<bool> condition_value = conditions->LookupCondition(condition);
if (condition_value.IsJust()) {
@@ -123,8 +122,7 @@ Reduction BranchElimination::ReduceIf(Node* node, bool is_true_branch) {
// yet because we will have to recompute anyway once we compute the
// predecessor.
if (from_branch == nullptr) {
- DCHECK(node_conditions_.Get(node) == nullptr);
- return NoChange();
+ return UpdateConditions(node, nullptr);
}
Node* condition = branch->InputAt(0);
return UpdateConditions(
@@ -145,8 +143,7 @@ Reduction BranchElimination::ReduceMerge(Node* node) {
// input.
for (int i = 0; i < node->InputCount(); i++) {
if (node_conditions_.Get(node->InputAt(i)) == nullptr) {
- DCHECK(node_conditions_.Get(node) == nullptr);
- return NoChange();
+ return UpdateConditions(node, nullptr);
}
}
@@ -209,7 +206,8 @@ Reduction BranchElimination::UpdateConditions(
// Only signal that the node has Changed if the condition information has
// changed.
if (conditions != original) {
- if (original == nullptr || *conditions != *original) {
+ if (conditions == nullptr || original == nullptr ||
+ *conditions != *original) {
node_conditions_.Set(node, conditions);
return Changed(node);
}
« no previous file with comments | « no previous file | src/compiler/pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698