RFR: 8349479: C2: when a Type node becomes dead, make CFG path that uses it unreachable [v7]

Roland Westrelin roland at openjdk.org
Mon Apr 7 15:25:11 UTC 2025


On Mon, 7 Apr 2025 06:52:13 GMT, Christian Hagedorn <chagedorn at openjdk.org> wrote:

>> if `new_type` is top?
>> As node's types are widen by CCP, a node `n` will initially be `top`, then one input changes and becomes not `top` but if the node has another input (say control), that other input will still be `top` so the type will be `top` again. Only once both inputs are not `top` is the type not `top`. So isn't there a good chance that most type nodes will initially be `top` and be enqueued anyway so filtering nodes when they are popped is still required and we don't gain much by doing what you suggest?
>
> That's true, for most nodes it probably does not matter. But I'm thinking about `Phi` nodes which could already be updated when one path is non-top. So, it might still be worth to do it after `Value()` only? IIUC, it does not matter from a correctness point of view if enqueue before or after `Value()` - we would still filter later for `top` either way.

What's your concern here? Is it that the list of nodes grows too big? Or that it's a waste of time to go over the list when analysis is over only to filter out non top nodes?
I suppose we could push nodes when their type is top and pop them when their type becomes not top during the analysis so, once analysis is over, the list would only contain nodes whose type is top. Do you think that would be better?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/23468#discussion_r2031488107


More information about the hotspot-compiler-dev mailing list