140 int l = limit.length;
141 if (a >= l) {
142 GraalDirectives.deoptimize();
143 }
144 if (a < 0) {
145 GraalDirectives.deoptimize();
146 }
147 return true;
148 }
149
150 public void test(String name, int logicCount) {
151 test(name, LogicNode.class, logicCount);
152 }
153
154 public void test(String name, Class<? extends Node> expectedClass, int expectedCount) {
155 StructuredGraph graph = parseEager(name, AllowAssumptions.YES);
156
157 PhaseContext context = new PhaseContext(getProviders());
158 CanonicalizerPhase canonicalizer = new CanonicalizerPhase();
159 graph.clearAllStateAfter();
160 canonicalizer.apply(graph, context);
161
162 new ConvertDeoptimizeToGuardPhase().apply(graph, context);
163 // new DominatorConditionalEliminationPhase(true).apply(graph, context);
164 new IterativeConditionalEliminationPhase(canonicalizer, true).apply(graph, context);
165 canonicalizer.apply(graph, context);
166 canonicalizer.apply(graph, context);
167
168 Assert.assertEquals(expectedCount, graph.getNodes().filter(expectedClass).count());
169 }
170 }
|
140 int l = limit.length;
141 if (a >= l) {
142 GraalDirectives.deoptimize();
143 }
144 if (a < 0) {
145 GraalDirectives.deoptimize();
146 }
147 return true;
148 }
149
150 public void test(String name, int logicCount) {
151 test(name, LogicNode.class, logicCount);
152 }
153
154 public void test(String name, Class<? extends Node> expectedClass, int expectedCount) {
155 StructuredGraph graph = parseEager(name, AllowAssumptions.YES);
156
157 PhaseContext context = new PhaseContext(getProviders());
158 CanonicalizerPhase canonicalizer = new CanonicalizerPhase();
159 graph.clearAllStateAfter();
160 graph.setGuardsStage(StructuredGraph.GuardsStage.AFTER_FSA);
161 canonicalizer.apply(graph, context);
162
163 new ConvertDeoptimizeToGuardPhase().apply(graph, context);
164 // new DominatorConditionalEliminationPhase(true).apply(graph, context);
165 new IterativeConditionalEliminationPhase(canonicalizer, true).apply(graph, context);
166 canonicalizer.apply(graph, context);
167 canonicalizer.apply(graph, context);
168
169 Assert.assertEquals(expectedCount, graph.getNodes().filter(expectedClass).count());
170 }
171 }
|