From 623d6f44695a5670b1ee04d58f75b7894a763c3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20W=C3=BCrthinger?= Date: Wed, 8 Mar 2017 21:56:49 +0100 Subject: [PATCH] Always move out of loops when value proxies are in the graph. --- .../graalvm/compiler/phases/schedule/SchedulePhase.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/graal/org.graalvm.compiler.phases/src/org/graalvm/compiler/phases/schedule/SchedulePhase.java b/graal/org.graalvm.compiler.phases/src/org/graalvm/compiler/phases/schedule/SchedulePhase.java index b9e63604a692..ed94c8189d5d 100644 --- a/graal/org.graalvm.compiler.phases/src/org/graalvm/compiler/phases/schedule/SchedulePhase.java +++ b/graal/org.graalvm.compiler.phases/src/org/graalvm/compiler/phases/schedule/SchedulePhase.java @@ -519,9 +519,12 @@ protected void calcLatestBlock(Block earliestBlock, SchedulingStrategy strategy, while (currentBlock.getLoopDepth() > earliestBlock.getLoopDepth() && currentBlock != earliestBlock.getDominator()) { Block previousCurrentBlock = currentBlock; currentBlock = currentBlock.getDominator(); - if (previousCurrentBlock.isLoopHeader() && currentBlock.probability() < latestBlock.probability()) { - // Only assign new latest block if frequency is actually lower. - latestBlock = currentBlock; + if (previousCurrentBlock.isLoopHeader()) { + if (currentBlock.probability() < latestBlock.probability() || ((StructuredGraph) currentNode.graph()).hasValueProxies()) { + // Only assign new latest block if frequency is actually lower or if + // loop proxies would be required otherwise. + latestBlock = currentBlock; + } } } }