RFR: 8260650: test failed with "assert(false) failed: infinite loop in PhaseIterGVN::optimize" [v2]

Vladimir Kozlov kvn at openjdk.java.net
Tue Mar 16 16:08:15 UTC 2021


On Tue, 16 Mar 2021 15:30:25 GMT, Igor Veresov <iveresov at openjdk.org> wrote:

>> The test constructs a large tree of `AddINode`s that add constants to a variable. The tree is completely constant-foldable. Depending of the processing order the folding process may happen in the loop in `PhaseIterGVN::transform_old()` instead of going through the worklist. That blows through the loop limit, which triggers assert. The solution is to make the loop limit proportional to the number of live nodes. I chose it to be `K*live_nodes()`, which is already the limit in `PhaseIterGVN::optimize()`. I also noticed the same problem in `PhaseGVN::transform_no_reclaim()` and adjusted the code accordingly.
>
> Igor Veresov has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Address Tobias' comments.

Changes requested by kvn (Reviewer).

src/hotspot/share/opto/phaseX.cpp line 850:

> 848:     k = i;
> 849: #ifdef ASSERT
> 850:     if (loop_count >= K * C->live_nodes()) {

This should be `K + C->live_nodes()` instead of `*`.
The code in `optimize()` uses `*` because it goes over all nodes. But here you iterate only one node.

src/hotspot/share/opto/phaseX.cpp line 1261:

> 1259:   while (i != NULL) {
> 1260: #ifdef ASSERT
> 1261:     if (loop_count >= K * C->live_nodes()) {

This should be `K + C->live_nodes()` instead of `*` because it iterates only one node.

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

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


More information about the hotspot-compiler-dev mailing list