From fe27a3326becaf1a59286fa03d9aaa22504ec4ee Mon Sep 17 00:00:00 2001 From: Cliff Click Date: Sat, 15 Mar 2025 12:55:57 -0700 Subject: Tests all pass --- chapter21/src/main/java/com/seaofnodes/simple/codegen/IFG.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'chapter21/src/main/java/com/seaofnodes') diff --git a/chapter21/src/main/java/com/seaofnodes/simple/codegen/IFG.java b/chapter21/src/main/java/com/seaofnodes/simple/codegen/IFG.java index bd6c2d56..729ec88e 100644 --- a/chapter21/src/main/java/com/seaofnodes/simple/codegen/IFG.java +++ b/chapter21/src/main/java/com/seaofnodes/simple/codegen/IFG.java @@ -207,8 +207,15 @@ abstract public class IFG { // Disallow clone-ables from killing registers. Just fail // them and re-clone closer to target... so no kill. // Special case for Intel XOR used to zero. - if( m.isClone() ) + Node n = (Node)m; + CFGNode effUseBlk = n.out(0) instanceof PhiNode phi ? phi.region().cfg(phi._inputs.find(n)) : n.out(0).cfg0(); + if( m.isClone() && // Must be clonable + (n.nOuts()>1 || // Has many users OR + // Only 1 user but effective use is remote block + effUseBlk != n.cfg0() )) + // Then fail the clonable; it should split or move alloc.fail(alloc.lrg((Node)m)); + // Else clonable cannot move else if( !tlrg.sub(killMask) ) alloc.fail(tlrg); } -- cgit v1.2.3