[13] RFR (XS): 8202952: C2: Unexpected dead nodes after matching

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Tue Jan 22 19:05:46 UTC 2019


http://cr.openjdk.java.net/~vlivanov/8202952/webrev.00/
https://bugs.openjdk.java.net/browse/JDK-8202952

The crash happens when PhaseCFG encounters a dead MachNode in the graph.
The problematic node is a leftover from matching of an instruction with 
a duplicated memory operand (sarI_mem_CL [1] in that particular case).

Address has the following shape [2]:
   AddP (AddP DecodeN (LShiftL ConvI2L ConI)) ConL

It could be subsumed into complex addressing expression, but the 
constant is too large (doesn't fit into immL32). So, matcher has to 
compute inner address expression separately and put it into a register.

Since memory operand is duplicated, 2 copies are materialized during 
matching, but as part of ::Expand() one of the copies is eliminated, 
thus leaving a dead mach node in the IR (for the address expression).

The fix is to adjust Matcher::clone_address_expressions() to avoid 
cloning inner AddP when constant offset is too large.

Testing: hs-precheckin-comp, hs-tier1, hs-tier2

Best regards,
Vladimir Ivanov

[1] instruct sarI_mem_CL(memory dst, rcx_RegI shift, rFlagsReg cr)
%{
   match(Set dst (StoreI dst (RShiftI (LoadI dst) shift)));


[2]
  o347 AddP  === _ o2181 o1768 o1769  [[o349 o371 ]]
     o1768 AddP  === _ o2181 o2181 o1765  [[o347 ]]
         o2181 DecodeN === _ o287  [[o1768 o1768 o327 o347 o327 ]] 
#int[int:>=0]:NotNull:exact *
         o1765 LShiftL === _ o1761 o60  [[o1768 ]]
             o1761 ConvI2L === _ o1741  [[o1765 ]] 
#long:maxint-51..maxint-48
             o60   ConI  === o0  [[o61 o1765 o1434 o2013 o1631 o2017 
o1808  60 ]]  #int:2
     o1769 ConL  === o0  [[o347 ]]  #long:-8589932784


More information about the hotspot-compiler-dev mailing list