diff options
| author | Cliff Click <cliffc@acm.org> | 2024-11-13 13:55:56 -0800 |
|---|---|---|
| committer | Cliff Click <cliffc@acm.org> | 2024-11-23 09:03:20 -0800 |
| commit | 01afee4d48b05dee7686090716e23d467fae9838 (patch) | |
| tree | d3798fe25c299033a27addc2d091c7d9b6450342 /chapter17/src/main/java | |
| parent | 68cd11f31dd4ba7f089d1a15de5a36ec67043da6 (diff) | |
| download | Simple-01afee4d48b05dee7686090716e23d467fae9838.tar.gz Simple-01afee4d48b05dee7686090716e23d467fae9838.zip | |
Minor inf loop fix
Diffstat (limited to 'chapter17/src/main/java')
| -rw-r--r-- | chapter17/src/main/java/com/seaofnodes/simple/node/LoopNode.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/chapter17/src/main/java/com/seaofnodes/simple/node/LoopNode.java b/chapter17/src/main/java/com/seaofnodes/simple/node/LoopNode.java index 22862cb9..27134420 100644 --- a/chapter17/src/main/java/com/seaofnodes/simple/node/LoopNode.java +++ b/chapter17/src/main/java/com/seaofnodes/simple/node/LoopNode.java @@ -34,7 +34,7 @@ public class LoopNode extends RegionNode { @Override public int loopDepth() { if( _loopDepth!=0 ) return _loopDepth; // Was already set - _loopDepth = entry()._loopDepth+1; // Entry depth plus one + _loopDepth = entry().loopDepth()+1; // Entry depth plus one // One-time tag loop exits for( CFGNode idom = back(); idom!=this; idom = idom.idom() ) { // Walk idom in loop, setting depth @@ -61,8 +61,9 @@ public class LoopNode extends RegionNode { CFGNode x = back(); while( x != this ) { if( x instanceof CProjNode exit && exit.in(0) instanceof IfNode iff ) { - Node other = iff.cproj(1-exit._idx); - if( !(other.out(0) instanceof LoopNode loop) || loop.entry()==exit ) + CFGNode other = iff.cproj(1-exit._idx); + //if( !(other.out(0) instanceof LoopNode loop) || loop.entry()==exit ) + if( other.loopDepth() < loopDepth() ) return; // Found an exit, not an infinite loop } x = x.idom(); |
