< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/SwitchDyingLoopTest.java

Print this page
rev 56282 : [mq]: graal

*** 1,7 **** /* ! * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 73,92 **** CanonicalizerPhase canonicalizerPhase = new CanonicalizerPhase(); HighTierContext highTierContext = getDefaultHighTierContext(); StructuredGraph graph = parseEager("snippet", StructuredGraph.AllowAssumptions.YES); // there should be 1 loop and 1 switch assertThat(graph.getNodes(LoopBeginNode.TYPE), hasCount(1)); ! assertThat(graph.getNodes(IntegerSwitchNode.TYPE), hasCount(1)); canonicalizerPhase.apply(graph, highTierContext); // after canonicalization, the loop and switch should still be there assertThat(graph.getNodes(LoopBeginNode.TYPE), hasCount(1)); ! assertThat(graph.getNodes(IntegerSwitchNode.TYPE), hasCount(1)); // add stamp to `a` so that paths leading to continue can be trimmed ParameterNode parameter = graph.getParameter(0); assertNotNull(parameter); parameter.setStamp(StampFactory.forInteger(JavaKind.Int, 0, 255, 0, 0xf)); canonicalizerPhase.apply(graph, highTierContext); // the loop should have disappeared and there should still be a switch assertThat(graph.getNodes(LoopBeginNode.TYPE), isEmpty()); ! assertThat(graph.getNodes(IntegerSwitchNode.TYPE), hasCount(1)); } } --- 73,92 ---- CanonicalizerPhase canonicalizerPhase = new CanonicalizerPhase(); HighTierContext highTierContext = getDefaultHighTierContext(); StructuredGraph graph = parseEager("snippet", StructuredGraph.AllowAssumptions.YES); // there should be 1 loop and 1 switch assertThat(graph.getNodes(LoopBeginNode.TYPE), hasCount(1)); ! assertThat(graph.getNodes().filter(IntegerSwitchNode.class), hasCount(1)); canonicalizerPhase.apply(graph, highTierContext); // after canonicalization, the loop and switch should still be there assertThat(graph.getNodes(LoopBeginNode.TYPE), hasCount(1)); ! assertThat(graph.getNodes().filter(IntegerSwitchNode.class), hasCount(1)); // add stamp to `a` so that paths leading to continue can be trimmed ParameterNode parameter = graph.getParameter(0); assertNotNull(parameter); parameter.setStamp(StampFactory.forInteger(JavaKind.Int, 0, 255, 0, 0xf)); canonicalizerPhase.apply(graph, highTierContext); // the loop should have disappeared and there should still be a switch assertThat(graph.getNodes(LoopBeginNode.TYPE), isEmpty()); ! assertThat(graph.getNodes().filter(IntegerSwitchNode.class), hasCount(1)); } }
< prev index next >