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

Roland Westrelin roland at openjdk.org
Tue Apr 8 12:41:18 UTC 2025


On Tue, 8 Apr 2025 10:29:01 GMT, Christian Hagedorn <chagedorn at openjdk.org> wrote:

>> 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?
>
> I was just thinking that we are only interested in those nodes whose types are potentially top after `analyze()`. And thus we only would need to add them to `_type_nodes` if they are actually top after calling `Value()`. We don't need to pop them when they become non-top (probably not that efficient). We can still do the pass over the list as you have it now in `PhaseCCP::transform()` - my hope is that it's a smaller list compared to unconditionally adding `Type` nodes.
> 
> I'm not expecting a significant impact doing it like that instead but it looked like an easy small improvement to do. Let me know what you think. I'm also fine with going with what you have now.
> 
> Additional suggestion here:
> You should also guard the `push` with `KillPathsReachableByDeadTypeNode`. Maybe you can add an additional assert in the `else` path of L2068 in `PhaseCCP::transform()` that `_type_nodes` is empty in that case as a sanity check.

Fair enough. I made the changes you suggested.

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

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


More information about the hotspot-compiler-dev mailing list