RFR: 8280126: C2: detect and remove dead irreducible loops [v3]
Emanuel Peter
epeter at openjdk.org
Wed Jan 25 11:31:11 UTC 2023
On Wed, 18 Jan 2023 07:49:20 GMT, Christian Hagedorn <chagedorn at openjdk.org> wrote:
>> Emanuel Peter has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Improvements after review (Vladimir K)
>
> src/hotspot/share/opto/cfgnode.cpp line 608:
>
>> 606: // The irreducible loop is dead - must remove it
>> 607: PhaseIterGVN* igvn = phase->is_IterGVN();
>> 608: remove_unreachable_subgraph(igvn);
>
> Since we are now always eagerly removing unreachable subgraphs in this case and for normal dead loops, I guess we can get rid of the caching of the `is_unreachable_from_root()` result managed with the `_is_unreachable_region` field.
I don't think that this is true. Note that only `is_unreachable_region` does the caching, and assumes that we have a canonical loop (one entry-control, one backedge). It is used both in `RegionNode::Ideal` (twice, so caching makes sense already. Without the caching the logic of that if becomes much more complex) and in `PhiNode::is_data_loop` (a phi might realize the loop is dead before the loop-head does, and already do the traversal - if the result is "unreachable", then we would like to have that value cached and immediately returned for the loop head).
Do you agree?
-------------
PR: https://git.openjdk.org/jdk/pull/11764
More information about the hotspot-compiler-dev
mailing list