summaryrefslogtreecommitdiff
path: root/chapter17b/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'chapter17b/src/main')
-rw-r--r--chapter17b/src/main/java/com/seaofnodes/simple/node/LoadNode.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/chapter17b/src/main/java/com/seaofnodes/simple/node/LoadNode.java b/chapter17b/src/main/java/com/seaofnodes/simple/node/LoadNode.java
index eaab680c..98d076b8 100644
--- a/chapter17b/src/main/java/com/seaofnodes/simple/node/LoadNode.java
+++ b/chapter17b/src/main/java/com/seaofnodes/simple/node/LoadNode.java
@@ -128,6 +128,9 @@ public class LoadNode extends MemOpNode {
// else ptr.x = e1; : e1;
// val = ptr.x; ptr.x = val;
if( mem() instanceof MemPhiNode memphi && memphi.region()._type == Type.CONTROL && memphi.nIns()== 3 &&
+ // Retain control on both copies only if it dominates both paths.
+ // The Region itself, or a later range check, cannot move to its inputs.
+ (in(0)==null || cfg0().domLCA(memphi.region().idom(this),this)==cfg0()) &&
// Offset can be hoisted
off() instanceof ConstantNode &&
// Pointer can be hoisted