JDK-8255120 : C2: assert(outer->outcnt() >= phis + 2 && outer->outcnt() <= phis + 2 + stores + 1) failed: only phis
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 16,17
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2020-10-21
  • Updated: 2023-08-10
  • Resolved: 2021-01-14
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 16 JDK 17
16 b33Fixed 17Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Sub Tasks
JDK-8255379 :  
Description
#  Internal Error (.../src/hotspot/share/opto/loopnode.cpp:1859), pid=63270, tid=23299
#  assert(outer->outcnt() >= phis + 2 && outer->outcnt() <= phis + 2 + stores + 1) failed: only phis

Current CompileTask:
C2:   8242 1612    b        BackedgeNodeWithOutOfLoopControl::test (75 bytes)

Stack: [0x000070000ebff000,0x000070000ecff000],  sp=0x000070000ecfa9d0,  free space=1006k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.dylib+0x11787d5]  VMError::report_and_die(int, char const*, char const*, __va_list_tag*, Thread*, unsigned char*, void*, void*, char const*, int, unsigned long)+0x6d5
V  [libjvm.dylib+0x1178f0b]  VMError::report_and_die(Thread*, void*, char const*, int, char const*, char const*, __va_list_tag*)+0x3b
V  [libjvm.dylib+0x61da3f]  report_vm_error(char const*, int, char const*, char const*, ...)+0x13f
V  [libjvm.dylib+0xca51a7]  LoopNode::verify_strip_mined(int) const+0xf37
V  [libjvm.dylib+0x5cdae1]  Compile::final_graph_reshaping_impl(Node*, Final_Reshape_Counts&)+0x581
V  [libjvm.dylib+0x5d1bdc]  Compile::final_graph_reshaping_walk(Node_Stack&, Node*, Final_Reshape_Counts&)+0x33c
V  [libjvm.dylib+0x5ca3df]  Compile::final_graph_reshaping()+0x2cf
V  [libjvm.dylib+0x5c2037]  Compile::Optimize()+0x387
V  [libjvm.dylib+0x5c05b9]  Compile::Compile(ciEnv*, ciMethod*, int, bool, bool, bool, bool, DirectiveSet*)+0x17f9


(lldb) p outer->dump(-1)
 333  OuterStripMinedLoop  ===  333  324  332  [[ 333  490  505  506 ]] 
 490  CountedLoop  ===  490  333  290  [[ 329  279  481  482  490  491  492  493  272 ]] inner stride: 8 main of N490 strip mined !orig=[462],[436],[334],[318],[255] !jvms: BackedgeNodeWithOutOfLoopControl::accessArrayVariables @ bci:8 BackedgeNodeWithOutOfLoopControl::test @ bci:65
 505  Phi  ===  333  60  280  [[ 491  516  509  519  493 ]]  #int:1..100001:www !orig=491,467,434,350,[348],262 !jvms: BackedgeNodeWithOutOfLoopControl::accessArrayVariables @ bci:8 BackedgeNodeWithOutOfLoopControl::test @ bci:65
 506  Phi  ===  333  386  279  [[ 492 ]]  #memory  Memory: @int[int:10]:NotNull:exact+any *,iid=40, idx=9; !orig=492,466,435,[338],[261] !jvms: BackedgeNodeWithOutOfLoopControl::accessArrayVariables @ bci:8 BackedgeNodeWithOutOfLoopControl::test @ bci:65

(lldb) p phis
(uint) $3 = 3

(lldb) p inner->dump(-1)
 490  CountedLoop  ===  490  333  290  [[ 329  279  481  482  490  491  492  493  272 ]] inner stride: 8 main of N490 strip mined !orig=[462],[436],[334],[318],[255] !jvms: BackedgeNodeWithOutOfLoopControl::accessArrayVariables @ bci:8 BackedgeNodeWithOutOfLoopControl::test @ bci:65
 329  CountedLoopEnd  ===  490  518  [[ 330  290 ]] [lt] P=0.900000, C=-1.000000 !orig=[289] !jvms: BackedgeNodeWithOutOfLoopControl::accessArrayVariables @ bci:5 BackedgeNodeWithOutOfLoopControl::test @ bci:65
 279  StoreI  ===  490  272  89  277  [[ 492  282  366  506  375 ]]  @int[int:>=0]:exact+any *, idx=6;  Memory: @int[int:10]:NotNull:exact[4] *,iid=40, idx=9; !orig=442 !jvms: BackedgeNodeWithOutOfLoopControl::accessArrayVariables @ bci:25 BackedgeNodeWithOutOfLoopControl::test @ bci:65
 481  LoadI  ===  490  482  89  [[ 277 ]]  @int[int:>=0]:exact+any *, idx=6; #int !orig=[457],[427],[276] !jvms: BackedgeNodeWithOutOfLoopControl::accessArrayVariables @ bci:22 BackedgeNodeWithOutOfLoopControl::test @ bci:65
 482  StoreI  ===  490  492  82  483  [[ 272  481 ]]  @int[int:>=0]:exact+any *, idx=6;  Memory: @int[int:10]:NotNull:exact[3] *,iid=40, idx=9; !orig=[458],[428],272 !jvms: BackedgeNodeWithOutOfLoopControl::accessArrayVariables @ bci:16 BackedgeNodeWithOutOfLoopControl::test @ bci:65
 491  Phi  ===  490  505  280  [[ 488 ]]  #int:1..100001:www !orig=467,434,350,[348],262 !jvms: BackedgeNodeWithOutOfLoopControl::accessArrayVariables @ bci:8 BackedgeNodeWithOutOfLoopControl::test @ bci:65
 492  Phi  ===  490  506  279  [[ 482 ]]  #memory  Memory: @int[int:10]:NotNull:exact+any *,iid=40, idx=9; !orig=466,435,[338],[261] !jvms: BackedgeNodeWithOutOfLoopControl::accessArrayVariables @ bci:8 BackedgeNodeWithOutOfLoopControl::test @ bci:65
 493  Phi  ===  490  505  280  [[ 280  489 ]]  #int:1..108001:www #tripcount !orig=465,437,262 !jvms: BackedgeNodeWithOutOfLoopControl::accessArrayVariables @ bci:8 BackedgeNodeWithOutOfLoopControl::test @ bci:65
 272  StoreI  ===  490  482  82  270  [[ 279 ]]  @int[int:>=0]:exact+any *, idx=6;  Memory: @int[int:10]:NotNull:exact[3] *,iid=40, idx=9; !jvms: BackedgeNodeWithOutOfLoopControl::accessArrayVariables @ bci:16 BackedgeNodeWithOutOfLoopControl::test @ bci:65

Comments
Thanks for you comment. We think so, too. The issue has only been seen once in 17.0.9 and we don't have the hs_err file, unfortunately.
10-08-2023

Hi Martin, my guess is that it is unrelated since JDK-8307683 only adds a new bail out to Loop Predication and JDK-8309119 additionally inserts assertion predicates for range checks with If nodes instead of only doing it for RangeCheck nodes. Both look unrelated to this assert.
09-08-2023

This assertion has been observed with OpenJDK "17.0.9-internal" 2023-08-03 on Windows. Note that it already contains backports of JDK-8309119 (internal pre-testing) and JDK-8307683. @chagedorn: Do you have an idea if this could be related?
09-08-2023

Changeset: 0148adf2 Author: Vladimir Ivanov <vlivanov@openjdk.org> Date: 2021-01-14 17:18:44 +0000 URL: https://git.openjdk.java.net/jdk16/commit/0148adf2
14-01-2021

from JDK-8256812: CTW-ing sunflow.jar from SPECjvm2008 hits the same assert, one of the failed run had -XX:StressSeed=2362630758121991930
23-11-2020

We are hitting this a lot in Valhalla (JDK-8255454).
27-10-2020

[~vlivanov] - This test failure is generating 4 failures per Tier6 job set. Please consider ProblemListing this test if a fix is not coming soon. Update: the most recently completed Tier7 has 16 of these test failures. Definitely need to ProblemList this test.
24-10-2020

ILW = Assert during C2 compilation (triggered or introduced by recent change), single compiler test, no workaround but disable compilation = HLM = P3
21-10-2020

It looks like either JDK-8255000 or JDK-8255026 triggers the assert. I'll look into it.
21-10-2020

The IR looks sane. So far, I suspect the problem is with the assert itself: 505 Phi has 2 Phi users in the inner loop (491 and 493).
21-10-2020

Roland, do you want to take a look at it?
21-10-2020