JDK-8075105 : soft match failure with LoopLimitNode
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 8u112,9
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2015-03-12
  • Updated: 2024-05-22
  • Resolved: 2016-02-25
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 9
9Fixed
Related Reports
Relates :  
Relates :  
Description
While running tests based on openjdk I've periodically hit the following assertion failure.

Default case invoked for: 
   opcode  = 153, "LoopLimit"
No matching rule for:
--N: o17720	If	=== o17718 o17728 o17727  [[o17721 o17722  959 ]] P=0.999999, C=-1.000000

   --N: o17728	Bool	=== _ o17727  [[o17720 ]] [lt]
   CMPOP  0  CMPOP
   CMPOPU  0  CMPOPU
   CMPOPUCF  0  CMPOPUCF

   --N: o17727	CmpU	=== _ o17857 o2654  [[o17728 o17720 ]] 

      --N: o17857	AddI	=== _ o17725 o17855  [[o17727 ]] 

         --N: o17725	LoopLimit	=== _ o30242 o763  [[o17857 ]] 

            --N: o30242	Binary	=== _ o2639 o2654  [[o17725 ]] 
            _Binary_rRegI_rRegI  0  _Binary_rRegI_rRegI
            _Binary_rax_RegI_rRegI  0  _Binary_rax_RegI_rRegI

               --N: o2639	LoadI	=== o14833 o2614 o2174  [[o18095 o2655 o2685 o2673 o17723 o30242 o18113  950 ]]  @java/util/IdentityHashMap$ValueIterator:NotNull:exact+16 *, name=index, idx=36; #int
               RREGI  0  RREGI
               RAX_REGI  0  RAX_REGI
               RBX_REGI  0  RBX_REGI
               RCX_REGI  0  RCX_REGI
               RDX_REGI  0  RDX_REGI
               RDI_REGI  0  RDI_REGI
               NO_RCX_REGI  0  NO_RCX_REGI
               NO_RAX_RDX_REGI  0  NO_RAX_RDX_REGI
               STACKSLOTI  100  storeSSI

               --N: o2654	LoadRange	=== o2645 o7 o2653  [[o2655 o17727 o19351 o2749 o15663 o17723 o30242 o18063 o18080  942  958 ]]  @java/lang/Object *[int:>=0]+16 *, idx=15; #int:>=0
               RREGI  0  RREGI
               RAX_REGI  0  RAX_REGI
               RBX_REGI  0  RBX_REGI
               RCX_REGI  0  RCX_REGI
               RDX_REGI  0  RDX_REGI
               RDI_REGI  0  RDI_REGI
               NO_RCX_REGI  0  NO_RCX_REGI
               NO_RAX_RDX_REGI  0  NO_RAX_RDX_REGI
               STACKSLOTI  100  storeSSI

            --N: o763	ConI	=== o0  [[o764 o15648 o2513 o18281 o18330 o13910 o18303 o17712 o17835 o17725 o17848 o17983 o18010 o18031 o18363 o18043 o18065 o18092 o18113 o18351 o18125 o18221 o18248 o18269 ]]  #int:2
            IMMI  10  IMMI
            IMMI2  0  IMMI2
            IMMI8  5  IMMI8
            IMMI16  10  IMMI16
            IMMU31  0  IMMU31
            RREGI  100  loadConI
            RAX_REGI  100  loadConI
            RBX_REGI  100  loadConI
            RCX_REGI  100  loadConI
            RDX_REGI  100  loadConI
            RDI_REGI  100  loadConI
            NO_RCX_REGI  100  loadConI
            NO_RAX_RDX_REGI  100  loadConI
            STACKSLOTI  200  storeSSI

         --N: o17855	ConI	=== o0  [[o17856 o17857 o17861 o17862 ]]  #int:-2
         IMMI  10  IMMI
         IMMI8  5  IMMI8
         IMMI16  10  IMMI16
         RREGI  100  loadConI
         RAX_REGI  100  loadConI
         RBX_REGI  100  loadConI
         RCX_REGI  100  loadConI
         RDX_REGI  100  loadConI
         RDI_REGI  100  loadConI
         NO_RCX_REGI  100  loadConI
         NO_RAX_RDX_REGI  100  loadConI
         STACKSLOTI  200  storeSSI

      --N: o2654	LoadRange	=== o2645 o7 o2653  [[o2655 o17727 o19351 o2749 o15663 o17723 o30242 o18063 o18080  942  958 ]]  @java/lang/Object *[int:>=0]+16 *, idx=15; #int:>=0
      RREGI  0  RREGI
      RAX_REGI  0  RAX_REGI
      RBX_REGI  0  RBX_REGI
      RCX_REGI  0  RCX_REGI
      RDX_REGI  0  RDX_REGI
      RDI_REGI  0  RDI_REGI
      NO_RCX_REGI  0  NO_RCX_REGI
      NO_RAX_RDX_REGI  0  NO_RAX_RDX_REGI
      STACKSLOTI  100  storeSSI

I can't easily provide a test case because of the complexity of our application.  The problem is clear from inspection.  LoopLimitNode has the following guard before the code which eliminates it.

  // Delay following optimizations until all loop optimizations
  // done to keep Ideal graph simple.
  if (!can_reshape || phase->C->major_progress())
    return NULL;

major_progress is cleared when starting PhaseIdealLoop and set if progress is made.  The final round of loop opts has a limit on the number of times it runs and if this limit is hit then major_progress is never cleared.  This inhibits the later removal the LoopLimitNode.
Comments
JDK-8136421 was not backported to 8u. Therefore, a separate fix for this issue must be produced for 8u. Here is a possibly solution to the problem: --- a/src/share/vm/opto/compile.cpp Thu Oct 08 10:25:45 2015 +0000 +++ b/src/share/vm/opto/compile.cpp Thu Oct 08 12:49:30 2015 -1000 @@ -2254,6 +2254,8 @@ if (failing()) return; } } + // Ensure that major progress is now clear + C->clear_major_progress(); { // Verify that all previous optimizations produced a valid graph
23-11-2016

Fixed by JDK-8136421 changes: http://hg.openjdk.java.net/jdk9/hs-comp/hotspot/rev/a41fe5ffa839#l355.1
25-02-2016

Thank you, Vladimir, I'll take a look!
16-03-2015

ILW=Assert in C2, some uncommon scenarios, none=MLH=P4
13-03-2015

Zoltan, we need clear _major_progress after inal round of loop opts. Also we need to add assert checks to expand_macro_nodes() after _igvn.optimize() to make sure macro nodes which should be removed were indeed removed. There are exceptions. For example, LoopLimit node may stay on 32 bit x86 see check in LoopLimitNode::Ideal(): if (is_power_of_2(stride_p) || // divisor is 2^n !Matcher::has_match_rule(Op_LoopLimit)) { // or no specialized Mach node?
12-03-2015