summaryrefslogtreecommitdiff
path: root/chapter25
diff options
context:
space:
mode:
Diffstat (limited to 'chapter25')
-rw-r--r--chapter25/src/main/java/com/seaofnodes/simple/node/Node.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/chapter25/src/main/java/com/seaofnodes/simple/node/Node.java b/chapter25/src/main/java/com/seaofnodes/simple/node/Node.java
index 8ca4662b..59c9f8e3 100644
--- a/chapter25/src/main/java/com/seaofnodes/simple/node/Node.java
+++ b/chapter25/src/main/java/com/seaofnodes/simple/node/Node.java
@@ -340,8 +340,11 @@ public abstract class Node implements Cloneable {
while( nIns()>0 ) { // Set all inputs to null, recursively killing unused Nodes
Node old_def = _inputs.removeLast();
// Revisit neighbor because removed use
- if( old_def != null && CODE.add(old_def).delUse(this) )
- old_def.kill(); // If we removed the last use, the old def is now dead
+ if( old_def != null ) {
+ if( CODE.add(old_def).delUse(this) )
+ old_def.kill(); // If we removed the last use, the old def is now dead
+ old_def.moveDepsToWorklist(); // Use-count changes can enable distant rewrites.
+ }
}
assert isDead(); // Really dead now
}