From 8f59422d357a00a2270a8f421966977e3979c2fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20Casta=C3=B1eda=20Lozano?= Date: Tue, 31 May 2022 06:59:49 +0000 Subject: [PATCH] 8285558: IGV: scheduling crashes on control-unreachable CFG nodes Reviewed-by: kvn, chagedorn --- .../ServerCompilerScheduler.java | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/utils/IdealGraphVisualizer/ServerCompiler/src/main/java/com/sun/hotspot/igv/servercompiler/ServerCompilerScheduler.java b/src/utils/IdealGraphVisualizer/ServerCompiler/src/main/java/com/sun/hotspot/igv/servercompiler/ServerCompilerScheduler.java index 1b9378dcdac..43de7740568 100644 --- a/src/utils/IdealGraphVisualizer/ServerCompiler/src/main/java/com/sun/hotspot/igv/servercompiler/ServerCompilerScheduler.java +++ b/src/utils/IdealGraphVisualizer/ServerCompiler/src/main/java/com/sun/hotspot/igv/servercompiler/ServerCompilerScheduler.java @@ -53,6 +53,7 @@ public class ServerCompilerScheduler implements Scheduler { public static final String WARNING_NOT_MARKED_WITH_BLOCK_START = "Region not marked with is_block_start"; public static final String WARNING_CFG_AND_INPUT_TO_PHI = "CFG node is a phi input"; public static final String WARNING_PHI_NON_DOMINATING_INPUTS = "Phi input that does not dominate the phi's input block"; + public static final String WARNING_CONTROL_UNREACHABLE_CFG = "Control-unreachable CFG node"; public InputNode inputNode; public Set succs = new HashSet<>(); @@ -327,20 +328,6 @@ public class ServerCompilerScheduler implements Scheduler { schedulePinned(); buildDominators(); scheduleLatest(); - - InputBlock noBlock = null; - for (InputNode n : graph.getNodes()) { - if (graph.getBlock(n) == null) { - if (noBlock == null) { - noBlock = graph.addArtificialBlock(); - blocks.add(noBlock); - } - - graph.setBlock(n, noBlock); - } - assert graph.getBlock(n) != null; - } - scheduleLocal(); check(); reportWarnings(); @@ -632,6 +619,12 @@ public class ServerCompilerScheduler implements Scheduler { block = controlSuccs.get(ctrlIn).get(0).block; } } + if (block == null) { + // This can happen for blockless CFG nodes that are not + // control-reachable from the root even after connecting orphans + // and widows (e.g. in disconnected control cycles). + continue; + } n.block = block; block.addNode(n.inputNode.getId()); } @@ -890,6 +883,9 @@ public class ServerCompilerScheduler implements Scheduler { if (isRegion(n) && !n.isBlockStart) { n.addWarning(Node.WARNING_NOT_MARKED_WITH_BLOCK_START); } + if (n.isCFG && n.block == null) { + n.addWarning(Node.WARNING_CONTROL_UNREACHABLE_CFG); + } if (!isPhi(n)) { continue; }