RFR: 8371464: C2: assert(no_dead_loop) failed: dead loop detected

Aleksey Shipilev shade at openjdk.org
Mon Dec 1 07:59:47 UTC 2025


On Fri, 28 Nov 2025 10:50:44 GMT, Roland Westrelin <roland at openjdk.org> wrote:

> Crash occurs because a `MergeMem` node references itself:
> 
> 
>  608  MergeMem  === _ 1 608 1 1 1 1 1 1 1 1 1 1 878  [[ 877 878 608 420 597 ]]  { - - - - - - - - - - N878:java/lang/Throwable (java/io/Serializable)+20 * [narrow] }  Memory: @BotPTR *+bot, idx=Bot; !orig=[524] !jvms: TestDeadLoopAtMergeMem::test @ bci:94 (line 62)
>  ```
> 
> Before IGVN, that part of the stream is:
> 
> 
>  522  Region  === 522 604 521  [[ 522 538 523 524 525 526 527 528 529 530 531 ]] #reducible  !jvms: TestDeadLoopAtMergeMem::test @ bci:75 (line 59)
>  524  Phi  === 522 608 464  [[ 588 581 564 546 564 559 ]]  #memory  Memory: @BotPTR *+bot, idx=Bot; !jvms: TestDeadLoopAtMergeMem::test @ bci:75 (line 59)
>  
>  538  If  === 522 535  [[ 539 540 ]] P=0.999000, C=-1.000000 !jvms: TestDeadLoopAtMergeMem::test @ bci:79 (line 59)
>  539  IfTrue  === 538  [[ 553 547 ]] #1 !jvms: TestDeadLoopAtMergeMem::test @ bci:79 (line 59)
>  540  IfFalse  === 538  [[ 548 546 ]] #0 !jvms: TestDeadLoopAtMergeMem::test @ bci:79 (line 59)
>  553  If  === 539 535  [[ 554 555 ]] P=0.999000, C=-1.000000 !jvms: TestDeadLoopAtMergeMem::test @ bci:82 (line 59)
>  554  IfTrue  === 553  [[ 562 560 ]] #1 !jvms: TestDeadLoopAtMergeMem::test @ bci:82 (line 59)
>  555  IfFalse  === 553  [[ 548 559 ]] #0 !jvms: TestDeadLoopAtMergeMem::test @ bci:82 (line 59)
>  
>  548  Region  === 548 _ 540 555  [[ 548 562 561 563 564 565 566 567 568 569 570 571 572 573 574 575 576 ]] #reducible  !jvms: TestDeadLoopAtMergeMem::test @ bci:88 (line 60)
>  564  Phi  === 548 _ 524 524  [[ 581 ]]  #memory  Memory: @BotPTR *+bot, idx=Bot; !jvms: TestDeadLoopAtMergeMem::test @ bci:85 (line 61)
> 
> 562  Region  === 562 548 554  [[ 562 600 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 596 ]] #reducible  !jvms: TestDeadLoopAtMergeMem::test @ bci:90 (line 62)
> 581  Phi  === 562 564 524  [[ 420 597 610 608 ]]  #memory  Memory: @BotPTR *+bot, idx=Bot; !jvms: TestDeadLoopAtMergeMem::test @ bci:90 (line 62)
> 
> 608  MergeMem  === _ 1 581 1 1 1 1 1 1 1 1 1 1 588  [[ 524 ]]  { - - - - - - - - - - N588:java/lang/Throwable (java/io/Serializable)+20 * [narrow] }  Memory: @BotPTR *+bot, idx=Bot; !jvms: TestDeadLoopAtMergeMem::test @ bci:94 (line 62)
> 
> 
> 522 is a loop head, 604 is the backedge. The loop becomes unreachable
> during IGVN. The loop body above is transformed to:
> 
> 
>  538  If  === 604 535  [[ 539 540 ]] P=0.999000, C=-1.000000 !jvms: TestDeadLoopAtMergeMem::test @ bci:79 (line 59)
>  539  IfTrue  === 538  [[ 562 547 560 ]] #1 !jvms: TestDeadLoopAtMergeMem::test @ bci:79 (l...

GHA failures in [com/sun/crypto/provider/Cipher/HPKE/KAT9180](https://github.com/rwestrel/jdk/actions/runs/19761317022#user-content-com_sun_crypto_provider_cipher_hpke_kat9180) would disappear if you merge from master. Actually, this might mean the PR base is quite old, and there might be other bugs on the intersection with this one. Merge from master and pass the GHA, maybe?

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

PR Comment: https://git.openjdk.org/jdk/pull/28554#issuecomment-3595112399


More information about the hotspot-compiler-dev mailing list