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

Unified Diff: src/compiler/common-operator-reducer.cc

Issue 2155123002: [turbofan] Eliminate checkpoints before return in common op reducer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix change notification 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 | « src/compiler/checkpoint-elimination.cc ('k') | test/mjsunit/compiler/regress-628773.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/common-operator-reducer.cc
diff --git a/src/compiler/common-operator-reducer.cc b/src/compiler/common-operator-reducer.cc
index be4d802f818d06c140a4b2ac7b6b50679a3b7e99..acb7f26cf9dcdb7413193e5f900e8d235ee8d90c 100644
--- a/src/compiler/common-operator-reducer.cc
+++ b/src/compiler/common-operator-reducer.cc
@@ -303,8 +303,16 @@ Reduction CommonOperatorReducer::ReducePhi(Node* node) {
Reduction CommonOperatorReducer::ReduceReturn(Node* node) {
DCHECK_EQ(IrOpcode::kReturn, node->opcode());
Node* const value = node->InputAt(0);
- Node* const effect = node->InputAt(1);
- Node* const control = node->InputAt(2);
+ Node* effect = NodeProperties::GetEffectInput(node);
+ Node* const control = NodeProperties::GetControlInput(node);
+ bool changed = false;
+ if (effect->opcode() == IrOpcode::kCheckpoint) {
+ // Any {Return} node can never be used to insert a deoptimization point,
+ // hence checkpoints can be cut out of the effect chain flowing into it.
+ effect = NodeProperties::GetEffectInput(effect);
+ NodeProperties::ReplaceEffectInput(node, effect);
+ changed = true;
+ }
if (value->opcode() == IrOpcode::kPhi &&
NodeProperties::GetControlInput(value) == control &&
effect->opcode() == IrOpcode::kEffectPhi &&
@@ -329,7 +337,7 @@ Reduction CommonOperatorReducer::ReduceReturn(Node* node) {
Replace(control, dead());
return Replace(dead());
}
- return NoChange();
+ return changed ? Changed(node) : NoChange();
}
« no previous file with comments | « src/compiler/checkpoint-elimination.cc ('k') | test/mjsunit/compiler/regress-628773.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698