RFR: 8286451: C2: assert(nb == 1) failed: only when the head is not shared

Christian Hagedorn chagedorn at openjdk.java.net
Tue Jun 7 12:44:07 UTC 2022


On Mon, 30 May 2022 13:50:08 GMT, Roland Westrelin <roland at openjdk.org> wrote:

> nb counts the number of loops that share a single head. The assert
> that fires is in code that handles the case of a self loop (a loop
> composed of a single block). There can be a self loop and multiple
> loops that share a head: the assert makes little sense and I propose
> to simply remove it.
> 
> I think there's another issue with this code: in the case of a self
> loop and multiple loops that share a head, the self loop can be any of
> the loop for which the head is cloned not only the one that's passed
> as argument to ciTypeFlow::clone_loop_head(). As a consequence, I
> moved the logic for self loops in the loop that's applied to all loops
> that share the loop head.

Looks good!

> nb counts the number of loops that share a single head

Maybe you also want to rename the variable to make it more clear what it counts.

test/hotspot/jtreg/compiler/ciTypeFlow/TestSharedLoopHead.java line 28:

> 26:  * @bug 8286451
> 27:  * @summary C2: assert(nb == 1) failed: only when the head is not shared
> 28:  * @run main/othervm TestSharedLoopHead

Could be converted to `@run driver TestSharedLoopHead` instead.

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

Marked as reviewed by chagedorn (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/8947


More information about the hotspot-compiler-dev mailing list