RFR: 8351645: C2: ExpandBitsNode::Ideal hits assert because of TOP input
Jatin Bhateja
jbhateja at openjdk.org
Wed Jun 11 10:22:13 UTC 2025
On Mon, 2 Jun 2025 11:53:23 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:
> Bugfix patch adds missing safe type access checks in Expand/Compress Ideal transforms. Problem occues during IGVN cleanups after partial peeling of loop.
>
> Test mentioned in the bug report has been included along with the patch.
>
> Kindly review.
>
> Best Regards,
> Jatin
Root Cause: Problem occurs during IGVN cleanup after partial peeling.
Partial peeling rotates the loop by bringing out the peel section and creating a new loop which begins with the non-peel section, followed by the peel section loop back.
To perform this translation, the compiler begins by cloning the original loop, brings the peel section into the new loop header, re-wires the new header to point to the start of the non-peel block (cut-point) of new loop and then stitches peel section of the cloned loop after non-peel section thereby rotating the original loop. Since the peel-section is the only usable part of the cloned loop hence all remaining part of the loop is swiped out by GVN cleanup.
In this case, during cleanups when the control reaches the ExpandBits/CompressBits idealization, it hits upon an unsafe use (is_* call) of mask input, which was tied to TOP node and results into an assertion failure, to fix the problem this PR adds safe isa_* call before unsafe accesses.
With default options, the problem only occurs with Long Expand/CompressBits because for integer variants, nodes get picked up in a different order from the IGVN worklist; we can use -XX:+StressIGVN to reproduce issues with integral variants.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/25586#issuecomment-2961931670
More information about the hotspot-compiler-dev
mailing list