use of org.graalvm.compiler.loop.LoopsData in project graal by oracle.
the class ReassociateInvariantPhase method run.
@SuppressWarnings("try")
@Override
protected void run(StructuredGraph graph) {
int iterations = 0;
DebugContext debug = graph.getDebug();
try (DebugContext.Scope s = debug.scope("ReassociateInvariants")) {
boolean changed = true;
while (changed) {
changed = false;
final LoopsData dataReassociate = new LoopsData(graph);
for (LoopEx loop : dataReassociate.loops()) {
changed |= loop.reassociateInvariants();
}
dataReassociate.deleteUnusedNodes();
iterations++;
debug.dump(DebugContext.VERBOSE_LEVEL, graph, "after iteration %d", iterations);
}
} catch (Throwable e) {
throw debug.handle(e);
}
}
use of org.graalvm.compiler.loop.LoopsData in project graal by oracle.
the class LoopsDataTest method testouterFirst.
@Test
public void testouterFirst() {
LoopsData loops = getLoopsData();
Set<LoopEx> seen = new HashSet<>();
for (LoopEx loop : loops.outerFirst()) {
assertFalse(seen.contains(loop), "%s has already been seen", loop);
if (loop.parent() != null) {
assertTrue(seen.contains(loop.parent()), "%s's parent (%s) should have already been seen", loop, loop.parent());
}
seen.add(loop);
}
}
use of org.graalvm.compiler.loop.LoopsData in project graal by oracle.
the class LoopFullUnrollPhase method run.
@Override
protected void run(StructuredGraph graph, PhaseContext context) {
DebugContext debug = graph.getDebug();
if (graph.hasLoops()) {
boolean peeled;
do {
peeled = false;
final LoopsData dataCounted = new LoopsData(graph);
dataCounted.detectedCountedLoops();
for (LoopEx loop : dataCounted.countedLoops()) {
if (getPolicies().shouldFullUnroll(loop)) {
debug.log("FullUnroll %s", loop);
LoopTransformations.fullUnroll(loop, context, canonicalizer);
FULLY_UNROLLED_LOOPS.increment(debug);
debug.dump(DebugContext.DETAILED_LEVEL, graph, "FullUnroll %s", loop);
peeled = true;
break;
}
}
dataCounted.deleteUnusedNodes();
} while (peeled);
}
}
use of org.graalvm.compiler.loop.LoopsData in project graal by oracle.
the class LoopPartialUnrollPhase method checkCounted.
private static boolean checkCounted(StructuredGraph graph, Graph.Mark mark) {
LoopsData dataCounted;
dataCounted = new LoopsData(graph);
dataCounted.detectedCountedLoops();
for (LoopEx anyLoop : dataCounted.loops()) {
if (graph.isNew(mark, anyLoop.loopBegin())) {
assert anyLoop.isCounted() : "pre/post transformation loses counted loop " + anyLoop.loopBegin();
}
}
return true;
}
use of org.graalvm.compiler.loop.LoopsData in project graal by oracle.
the class CountedLoopTest method checkHighTierGraph.
@Override
protected boolean checkHighTierGraph(StructuredGraph graph) {
LoopsData loops = new LoopsData(graph);
loops.detectedCountedLoops();
for (IVPropertyNode node : graph.getNodes().filter(IVPropertyNode.class)) {
node.rewrite(loops);
}
assert graph.getNodes().filter(IVPropertyNode.class).isEmpty();
return true;
}
Aggregations