RFR: 8280126: C2: detect and remove dead irreducible loops [v2]

Emanuel Peter epeter at openjdk.org
Thu Jan 12 09:15:25 UTC 2023


On Wed, 11 Jan 2023 17:53:26 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:

>> Emanuel Peter has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:
>> 
>>  - Merge branch 'master' into JDK-8280126
>>  - 8280126: C2: detect and remove dead irreducible loops
>
> src/hotspot/share/ci/ciTypeFlow.cpp line 2712:
> 
>> 2710:     if (outermost_irreducible_head != nullptr) {
>> 2711:       outermost_irreducible_head->set_irreducible_loop_head();
>> 2712:     }
> 
> Need comment.  What is logic behind this code? Why outermost?

I am unsure now. I will try marking all `lp->head()` here as irreducible loop heads.
I can do that inside `lp->set_irreducible(succ)`. That would be cleaner.

> src/hotspot/share/opto/cfgnode.cpp line 1971:
> 
>> 1969: bool PhiNode::must_wait_for_region_in_irreducible_loop(PhaseGVN* phase) const {
>> 1970:   assert(in(0) != nullptr && in(0)->is_Region(),
>> 1971:          "Phi must have Region as control");
> 
> `as_Region()` call has the assert so you don't need to check for `Region` here.

Ah perfect! Will remove the assert.

> src/hotspot/share/opto/loopnode.cpp line 5058:
> 
>> 5056:     }
>> 5057:   }
>> 5058:   //if (_verify_only && _verify_me == nullptr) {
> 
> Leftover from debugging?

@TobiHartmann already asked about this too.
The idea is that I will un-comment this later, and only do the verification during `PhaseIdealLoop::verify`.
In the PR description I wrote:
>TODO: once we have agreement on the patch, only run verify_regions_in_irreducible_loops during loopopts verification phase. For now I leave it in to improve testing capability, at cost of extra runtime.

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

PR: https://git.openjdk.org/jdk/pull/11764


More information about the hotspot-compiler-dev mailing list