RFR: JDK-8284944: assert(cnt++ < 40) failed: infinite cycle in loop optimization [v2]

Tobias Holenstein duke at openjdk.java.net
Mon May 23 11:19:39 UTC 2022


On Wed, 18 May 2022 15:12:59 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:

> Having > 40 cycles in loopopts is bug - something wrong gone there. That is what this assert for. We should detect such case in loop opts and stop early.
> I don't think removing this assert is correct thing.


Thanks for your comment!

I have attached the the output of `TestMaxLoopOptsCountReached.java` run with `-XX:+TraceLoopOpts` in JIRA: https://bugs.openjdk.java.net/secure/attachment/99052/Output%20TraceLoopOpts.txt

It does a lot of loop unswitching but it seems that all loop optimizations are valid. The way the assert is implemented it can only be triggered if `PartialPeelLoop` is turned off. When `PartialPeelLoop` is turned on the assert can never be triggered and the loop optimizations are stopped after `LoopOptsCount` iterations (see PR description). I don't think it necessarily means that there is a bug if `LoopOptsCount` many loop optimizations are performed. 

I agree that this could help detect potential bugs, but there can also be false positives (e.g. TestMaxLoopOptsCountReached.java). I am not sure if there is a reliable way to detect such false positives. What do you think?

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

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


More information about the hotspot-compiler-dev mailing list