Skip to content

Commit 1ee928c

Browse files
gergo-davleopo
authored andcommitted
[GR-47479] [GR-47477] Add GraphUtil.unproxifyExceptLoopProxies helper
PullRequest: graal/15099
2 parents 8e6177a + 757d122 commit 1ee928c

File tree

1 file changed

+16
-0
lines changed
  • compiler/src/jdk.internal.vm.compiler/src/org/graalvm/compiler/nodes/util

1 file changed

+16
-0
lines changed

compiler/src/jdk.internal.vm.compiler/src/org/graalvm/compiler/nodes/util/GraphUtil.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,22 @@ public static ValueNode unproxify(ValueProxy value) {
688688
}
689689
}
690690

691+
/**
692+
* Gets the original value by iterating through all {@link ValueProxy value proxies}, except
693+
* {@link ProxyNode ProxyNodes}. That is, this method looks through pi nodes, value anchors,
694+
* etc., but it does not enter loops.
695+
*
696+
* @param original the start value
697+
* @return the first non-proxy or loop proxy value encountered
698+
*/
699+
public static ValueNode unproxifyExceptLoopProxies(ValueNode original) {
700+
ValueNode node = original;
701+
while (node instanceof ValueProxy proxy && !(node instanceof ProxyNode)) {
702+
node = proxy.getOriginalNode();
703+
}
704+
return node;
705+
}
706+
691707
public static ValueNode skipPi(ValueNode node) {
692708
ValueNode n = node;
693709
while (n instanceof PiNode) {

0 commit comments

Comments
 (0)