RFR: 8306933: C2: "assert(false) failed: infinite loop" failure

Christian Hagedorn chagedorn at openjdk.org
Thu Apr 27 10:45:23 UTC 2023


On Wed, 26 Apr 2023 15:36:13 GMT, Roland Westrelin <roland at openjdk.org> wrote:

> The assert fires because an infinite loop appears in the graph after
> loop opts are over.
> 
> After loop opts, the `for(;;)` loop contains a null check and a range
> check for `array[i]`. So it's not considered an infinite loop (it has
> exits to uncommon traps). The null check and range check are redundant
> with the one right before the loop: `int v = array2[k];` IGVN can
> optimize it but it doesn't happen until after loop opts when a
> `ConvI2L` for the `array[i]` access is processed as part of post loop
> opts IGVN. The `for(;;)` loop is then emptied and only contains a
> `Loop` and a `Safepoint` nodes.
> 
> I propose removing the assert (at least for now) as I don't see a way
> to guarantee no infinite loop can appear after loop opts.

That looks reasonable!

test/hotspot/jtreg/compiler/c2/TestInfiniteLoopCompilationFailure.java line 31:

> 29:  *                   -XX:+StressIGVN -XX:StressSeed=675320863 TestInfiniteLoopCompilationFailure
> 30:  * @run main/othervm -Xcomp -XX:CompileOnly=TestInfiniteLoopCompilationFailure::test -XX:-UseLoopPredicate -XX:-UseProfiledLoopPredicate
> 31:  *                   -XX:+StressIGVN TestInfiniteLoopCompilationFailure

Since `StressIGVN` is diagnostic, you need to add `-XX:+UnlockDiagnosticVMOptions` here.

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

Changes requested by chagedorn (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/13672#pullrequestreview-1403716416
PR Review Comment: https://git.openjdk.org/jdk/pull/13672#discussion_r1178957313


More information about the hotspot-compiler-dev mailing list