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

Unified Diff: src/compiler/control-reducer.cc

Issue 1161583002: [turbofan] Properly kill Terminate nodes when removing loops. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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 | test/mjsunit/compiler/regress-491578.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/control-reducer.cc
diff --git a/src/compiler/control-reducer.cc b/src/compiler/control-reducer.cc
index 59c63f7f9bd1335109ac6a5e43feffcb756a345f..3d19edb5ed23c274d166bff523d72878120de2a6 100644
--- a/src/compiler/control-reducer.cc
+++ b/src/compiler/control-reducer.cc
@@ -423,10 +423,16 @@ class ControlReducerImpl final : public AdvancedReducer {
if (live == 0) return dead(); // no remaining inputs.
- // Gather phis and effect phis to be edited.
+ // Gather terminates, phis and effect phis to be edited.
NodeVector phis(zone_);
+ Node* terminate = nullptr;
for (Node* const use : node->uses()) {
- if (NodeProperties::IsPhi(use)) phis.push_back(use);
+ if (NodeProperties::IsPhi(use)) {
+ phis.push_back(use);
+ } else if (use->opcode() == IrOpcode::kTerminate) {
+ DCHECK_NULL(terminate);
+ terminate = use;
+ }
}
if (live == 1) {
@@ -434,6 +440,8 @@ class ControlReducerImpl final : public AdvancedReducer {
for (Node* const phi : phis) {
Replace(phi, phi->InputAt(live_index));
}
+ // The terminate is not needed anymore.
+ if (terminate) Replace(terminate, dead());
// The merge itself is redundant.
return node->InputAt(live_index);
}
« no previous file with comments | « no previous file | test/mjsunit/compiler/regress-491578.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698