diff options
| author | Cliff Click <cliffc@acm.org> | 2024-10-22 15:57:10 -0700 |
|---|---|---|
| committer | Cliff Click <cliffc@acm.org> | 2024-10-23 09:11:10 -0700 |
| commit | c6a1a6d0b546ba249030d10e5a7fe9be78fece88 (patch) | |
| tree | 445210270c37680d11022b1b1f060f46b77bf4ad | |
| parent | 0286fc81d9d7726cd878e9f67ec1c021b9f1e17b (diff) | |
| download | Simple-c6a1a6d0b546ba249030d10e5a7fe9be78fece88.tar.gz Simple-c6a1a6d0b546ba249030d10e5a7fe9be78fece88.zip | |
Fixes in GCM
Several incorrect tests meant not late-scheduling many nodes, which instead lived with the sub-optimal early schedule
| -rw-r--r-- | chapter16/src/main/java/com/seaofnodes/simple/GlobalCodeMotion.java | 11 | ||||
| -rw-r--r-- | chapter16/src/main/java/com/seaofnodes/simple/Parser.java | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/chapter16/src/main/java/com/seaofnodes/simple/GlobalCodeMotion.java b/chapter16/src/main/java/com/seaofnodes/simple/GlobalCodeMotion.java index fb6477d3..29841266 100644 --- a/chapter16/src/main/java/com/seaofnodes/simple/GlobalCodeMotion.java +++ b/chapter16/src/main/java/com/seaofnodes/simple/GlobalCodeMotion.java @@ -66,7 +66,7 @@ public abstract class GlobalCodeMotion { // Reverse Post-Order on CFG for( int j=rpo.size()-1; j>=0; j-- ) { CFGNode cfg = rpo.get(j); - cfg.loopDepth(); + cfg.loopDepth(); // Pre-compute loop depth for( Node n : cfg._inputs ) _schedEarly(n,visit); if( cfg instanceof RegionNode ) @@ -138,13 +138,14 @@ public abstract class GlobalCodeMotion { // All uses done? for( Node use : n._outputs ) - if( use!=null && late[use._nid]==null ) + if( use!=null && late[use._nid]==null && !(use instanceof PhiNode) ) continue outer; // Nope, await all uses done // Loads need their memory inputs' uses also done if( n instanceof LoadNode ld ) for( Node memuse : ld.mem()._outputs ) - if( late[memuse._nid]==null && + if( !(memuse instanceof PhiNode) && + late[memuse._nid]==null && // Load-use directly defines memory (memuse._type instanceof TypeMem || // Load-use indirectly defines memory @@ -250,9 +251,9 @@ public abstract class GlobalCodeMotion { // private static CFGNode anti_dep( LoadNode load, CFGNode stblk, CFGNode defblk, CFGNode lca, Node st ) { // Walk store blocks "reach" from its scheduled location to its earliest - for( ; stblk != defblk.idom(); stblk = stblk.idom() ) { + for( ; stblk != defblk; stblk = stblk.idom() ) { // Store and Load overlap, need anti-dependence - if( stblk._anti==load._nid ) { + if( !(stblk instanceof IfNode) && stblk._anti==load._nid ) { lca = stblk._idom(lca,null); // Raise Loads LCA if( lca == stblk && st != null && st._inputs.find(load) == -1 ) // And if something moved, st.addDef(load); // Add anti-dep as well diff --git a/chapter16/src/main/java/com/seaofnodes/simple/Parser.java b/chapter16/src/main/java/com/seaofnodes/simple/Parser.java index d2a1a9ae..a8064e17 100644 --- a/chapter16/src/main/java/com/seaofnodes/simple/Parser.java +++ b/chapter16/src/main/java/com/seaofnodes/simple/Parser.java @@ -918,7 +918,7 @@ public class Parser { // Arrays include control, as a proxy for a safety range check // Structs don't need this; they only need a NPE check which is // done via the type system. - if( base.isAry() ) load.setDef(0,ctrl()); + //if( base.isAry() ) load.setDef(0,ctrl()); return parsePostfix(load.peephole()); } |
