diff options
Diffstat (limited to 'chapter22/src/main')
| -rw-r--r-- | chapter22/src/main/java/com/seaofnodes/simple/node/LoadNode.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/chapter22/src/main/java/com/seaofnodes/simple/node/LoadNode.java b/chapter22/src/main/java/com/seaofnodes/simple/node/LoadNode.java index 3084b4f7..c48c4896 100644 --- a/chapter22/src/main/java/com/seaofnodes/simple/node/LoadNode.java +++ b/chapter22/src/main/java/com/seaofnodes/simple/node/LoadNode.java @@ -89,8 +89,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 && - // Array access control must not be moved across the merge. - in(0)==null && + // 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 |
