# HG changeset patch # User Thomas Wuerthinger # Date 1423772567 -3600 # Node ID 9a12234da10cfa6934617274c203672389a1bbdd # Parent 3370072ffbfb105a97961abe4512916512f69056 Simplification to ControlFlowGraph#identifyBlock. diff -r 3370072ffbfb -r 9a12234da10c graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/ControlFlowGraph.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/ControlFlowGraph.java Thu Feb 12 21:17:30 2015 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/ControlFlowGraph.java Thu Feb 12 21:22:47 2015 +0100 @@ -118,42 +118,39 @@ return loops; } - public void clearNodeToBlock() { - nodeToBlock.clear(); - for (Block block : reversePostOrder) { - identifyBlock(block); - } - } - private void identifyBlock(Block block) { - Node cur = block.getBeginNode(); - Node last; + AbstractBeginNode start = block.getBeginNode(); // assign proxies of a loop exit to this block - if (cur instanceof AbstractBeginNode) { - for (Node usage : cur.usages()) { + if (start instanceof LoopExitNode) { + for (Node usage : start.usages()) { if (usage instanceof ProxyNode) { nodeToBlock.set(usage, block); } } + } else if (start instanceof AbstractMergeNode) { + for (PhiNode phi : ((AbstractMergeNode) start).phis()) { + nodeToBlock.set(phi, block); + } } - do { + FixedWithNextNode cur = start; + while (true) { assert !cur.isDeleted(); - assert nodeToBlock.get(cur) == null; nodeToBlock.set(cur, block); - if (cur instanceof AbstractMergeNode) { - for (PhiNode phi : ((AbstractMergeNode) cur).phis()) { - nodeToBlock.set(phi, block); - } + FixedNode next = cur.next(); + if (next instanceof AbstractBeginNode) { + block.endNode = cur; + return; + } else if (next instanceof FixedWithNextNode) { + cur = (FixedWithNextNode) next; + } else { + nodeToBlock.set(next, block); + block.endNode = next; + return; } - - last = cur; - cur = cur.successors().first(); - } while (cur != null && !(cur instanceof AbstractBeginNode)); - - block.endNode = (FixedNode) last; + } } private void identifyBlocks() {