Skip to content

Commit

Permalink
[GR-47479] [GR-47477] Add GraphUtil.unproxifyExceptLoopProxies helper
Browse files Browse the repository at this point in the history
PullRequest: graal/15099
  • Loading branch information
gergo- authored and davleopo committed Jul 27, 2023
2 parents 8e6177a + 757d122 commit 1ee928c
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,22 @@ public static ValueNode unproxify(ValueProxy value) {
}
}

/**
* Gets the original value by iterating through all {@link ValueProxy value proxies}, except
* {@link ProxyNode ProxyNodes}. That is, this method looks through pi nodes, value anchors,
* etc., but it does not enter loops.
*
* @param original the start value
* @return the first non-proxy or loop proxy value encountered
*/
public static ValueNode unproxifyExceptLoopProxies(ValueNode original) {
ValueNode node = original;
while (node instanceof ValueProxy proxy && !(node instanceof ProxyNode)) {
node = proxy.getOriginalNode();
}
return node;
}

public static ValueNode skipPi(ValueNode node) {
ValueNode n = node;
while (n instanceof PiNode) {
Expand Down

0 comments on commit 1ee928c

Please sign in to comment.