[jdk20] RFR: 8298353: C2 fails with assert(opaq->outcnt() == 1 && opaq->in(1) == limit) failed

Roland Westrelin roland at openjdk.org
Fri Dec 9 08:51:16 UTC 2022


After some unrolling, when C2 runs loop opts with split if enabled
after CCP, the limit of the main loop of the counted loop (the second
loop in the test) is: limit - 3

That commons with the limit - 3 returned from the first loop. limit -
3 is thus in the first loop's body but only used outside of the
loop. It has 3 uses: The return in the first loop, the
OpaqueZeroTripGuard and loop exit conditionof the main loop. In the
same pass of loop opts, limit-3 is cloned out of the loop 3 times for
its 3 uses and unrolling is attempted. Because the OpaqueZeroTripGuard
and the loop exit condition now use 2 different nodes (until they
common at next igvn), the assert fires.

The fix I propose restores the behavior before the introduction of
OpaqueZeroTripGuard which is to not sink a node if it has an Opaque1
use.

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

Commit messages:
 - fix
 - test

Changes: https://git.openjdk.org/jdk20/pull/6/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk20&pr=6&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8298353
  Stats: 80 lines in 2 files changed: 79 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk20/pull/6.diff
  Fetch: git fetch https://git.openjdk.org/jdk20 pull/6/head:pull/6

PR: https://git.openjdk.org/jdk20/pull/6


More information about the hotspot-compiler-dev mailing list