Skip to content

Commit

Permalink
Fix malformed test graph
Browse files Browse the repository at this point in the history
  • Loading branch information
tkrodriguez committed Oct 20, 2024
1 parent 1a5c838 commit c7c9bbe
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@

import java.util.Optional;

import jdk.graal.compiler.debug.DebugOptions;
import org.junit.Assert;
import org.junit.Test;

import jdk.graal.compiler.api.directives.GraalDirectives;
import jdk.graal.compiler.core.common.GraalOptions;
import jdk.graal.compiler.debug.DebugOptions;
import jdk.graal.compiler.debug.TTY;
import jdk.graal.compiler.graph.Graph;
import jdk.graal.compiler.nodes.EndNode;
Expand All @@ -40,6 +40,7 @@
import jdk.graal.compiler.nodes.GraphState;
import jdk.graal.compiler.nodes.LoopBeginNode;
import jdk.graal.compiler.nodes.LoopEndNode;
import jdk.graal.compiler.nodes.LoopExitNode;
import jdk.graal.compiler.nodes.PhiNode;
import jdk.graal.compiler.nodes.StructuredGraph;
import jdk.graal.compiler.nodes.StructuredGraph.AllowAssumptions;
Expand Down Expand Up @@ -78,7 +79,7 @@ public void test01() {
test(opt, "snippet01");
Assert.fail("Should have detected that the phase in this class does not retain the mustNotSafepoint flag of a loop begin");
} catch (Throwable t) {
assert t.getMessage().contains("previously the loop had canHaveSafepoints=false but now it has canHaveSafepoints=true");
assert t.toString().contains("previously the loop had canHaveSafepoints=false but now it has canHaveSafepoints=true") : t;
}
}

Expand Down Expand Up @@ -144,6 +145,9 @@ protected void run(StructuredGraph graph, HighTierContext context) {

LoopBeginNode oldLoopBegin = lex.loopBegin();
EndNode fwd = oldLoopBegin.forwardEnd();
for (LoopExitNode exit : oldLoopBegin.loopExits().snapshot()) {
exit.setLoopBegin(lb);
}

FixedNode next = oldLoopBegin.next();
oldLoopBegin.setNext(null);
Expand All @@ -153,10 +157,8 @@ protected void run(StructuredGraph graph, HighTierContext context) {
lb.addForwardEnd(fwdEnd);

FixedWithNextNode fwn = (FixedWithNextNode) fwd.predecessor();
fwn.setNext(null);
GraphUtil.killCFG(fwd);
fwn.setNext(fwdEnd);

GraphUtil.killCFG(fwd);
}

});
Expand Down

0 comments on commit c7c9bbe

Please sign in to comment.