RFR: 8370200: Crash: assert(outer->outcnt() >= phis + 2 - be_loads && outer->outcnt() <= phis + 2 + stores + 1) failed: only phis [v3]
Daniel Lundén
dlunden at openjdk.org
Thu Dec 11 10:58:28 UTC 2025
On Thu, 11 Dec 2025 09:48:22 GMT, Roland Westrelin <roland at openjdk.org> wrote:
>> The crash occurs because verification code expects the inner and outer
>> loop of a loop strip mining nest to have the same number of phis but,
>> in this case, the inner loop has one more memory phis than the outer
>> loop.
>>
>> 1) After `OuterStripMinedLoopNode::adjust_strip_mined_loop`, inner and
>> outer loops have the same number of phis, as expected.
>>
>>
>> 309 MergeMem === _ 1 306 1 1 284 [[ 429 ]] { - - N284:instptr:java/lang/Throwable (java/io/Serializable):BotPTR+20,iid=bot [narrow] } Memory: @ptr:BotPTR+bot, idx=Bot; !orig=205 !jvms: TestMismatchedMemoryPhis::mainTest @ bci:37 (line 49)
>>
>> 248 OuterStripMinedLoop === 248 321 247 [[ 248 249 428 429 430 ]]
>> 429 Phi === 248 309 205 [[ 93 ]] #memory Memory: @ptr:BotPTR+bot, idx=Bot; !orig=93 !jvms: TestMismatchedMemoryPhis::mainTest @ bci:37 (line 49)
>> 430 Phi === 248 306 121 [[ 94 ]] #memory Memory: @instptr:TestMismatchedMemoryPhis:BotPTR+16,iid=bot, name=l, idx=4; !orig=94 !jvms: TestMismatchedMemoryPhis::mainTest @ bci:37 (line 49)
>>
>> 249 CountedLoop === 249 248 197 [[ 249 119 96 93 94 ]] inner stride: 1 strip mined !orig=[223],[91] !jvms: TestMismatchedMemoryPhis::mainTest @ bci:37 (line 49)
>> 93 Phi === 249 429 205 [[ 117 97 ]] #memory Memory: @ptr:BotPTR+bot, idx=Bot; !jvms: TestMismatchedMemoryPhis::mainTest @ bci:37 (line 49)
>> 94 Phi === 249 430 121 [[ 97 ]] #memory Memory: @instptr:TestMismatchedMemoryPhis:BotPTR+16,iid=bot, name=l, idx=4; !jvms: TestMismatchedMemoryPhis::mainTest @ bci:37 (line 49)
>>
>>
>> 2) Then `PhiNode::Ideal` runs for 429 and pushed the `MergeMem` 309
>> through the outer loop phi:
>>
>>
>> 248 OuterStripMinedLoop === 248 321 247 [[ 248 249 428 429 430 444 446 ]]
>> 430 Phi === 248 306 121 [[ 94 ]] #memory Memory: @instptr:TestMismatchedMemoryPhis:BotPTR+16,iid=bot, name=l, idx=4; !orig=94 !jvms: TestMismatchedMemoryPhis::mainTest @ bci:37 (line 49)
>> 444 Phi === 248 306 121 [[ 445 ]] #memory Memory: @ptr:BotPTR+bot, idx=Bot; !orig=429,93 !jvms: TestMismatchedMemoryPhis::mainTest @ bci:37 (line 49)
>> 446 Phi === 248 284 170 [[ 445 ]] #memory Memory: @instptr:java/lang/Throwable (java/io/Serializable):BotPTR+20,iid=bot [narrow], name=detailMessage, idx=5; !orig=444,429,93 !jvms: TestMismatchedMemoryPhis::mainTest @ bci:37 (line 49)
>>
>> 445 MergeMem === _ 1 444 1 1 446 [[ 93 ]] { - - N446:instptr:java/lang/Throwable (java/io/Serializable):BotPTR+20,iid=bot [narrow] } Memory: @ptr:BotPTR+bot, idx...
>
> Roland Westrelin has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains eight additional commits since the last revision:
>
> - review
> - Merge branch 'master' into JDK-8370200
> - Update test/hotspot/jtreg/compiler/loopstripmining/TestMismatchedMemoryPhis.java
>
> Co-authored-by: Roberto Castañeda Lozano <robcasloz at users.noreply.github.com>
> - Update test/hotspot/jtreg/compiler/loopstripmining/TestMismatchedMemoryPhis.java
>
> Co-authored-by: Roberto Castañeda Lozano <robcasloz at users.noreply.github.com>
> - more
> - test
> - more
> - fix
Looks good @rwestrel! A few very minor suggestions.
src/hotspot/share/opto/cfgnode.cpp line 2689:
> 2687: // doesn't happen.
> 2688: // Look for non bottom Phis that should be transformed and enqueue them for igvn so PhiNode::Identity executes for
> 2689: // them.
Suggestion:
// PhiNode::Identity replaces a non-bottom memory phi with a bottom memory phi with the same inputs, if it exists.
// If the bottom memory phi's inputs are changed (so it can now replace the non-bottom memory phi) or if it's created
// only after the non-bottom memory phi is processed by igvn, PhiNode::Identity doesn't run and the transformation
// doesn't happen.
// Look for non-bottom Phis that should be transformed and enqueue them for igvn so that PhiNode::Identity executes for
// them.
src/hotspot/share/opto/node.cpp line 2898:
> 2896: }
> 2897:
> 2898:
Suggestion:
test/hotspot/jtreg/compiler/loopstripmining/TestMismatchedMemoryPhis.java line 44:
> 42: int i, i1, i15 = 4, i16 = 4;
> 43: for (i = 1; i < 7; ++i) {
> 44: l = i;
Suggestion:
l = i;
-------------
Marked as reviewed by dlunden (Committer).
PR Review: https://git.openjdk.org/jdk/pull/28677#pullrequestreview-3566848963
PR Review Comment: https://git.openjdk.org/jdk/pull/28677#discussion_r2610119032
PR Review Comment: https://git.openjdk.org/jdk/pull/28677#discussion_r2610122033
PR Review Comment: https://git.openjdk.org/jdk/pull/28677#discussion_r2610121611
More information about the hotspot-compiler-dev
mailing list