RFR: 8286800: Assert in PhaseIdealLoop::dump_real_LCA is too strong

Christian Hagedorn chagedorn at openjdk.org
Mon Nov 7 11:30:01 UTC 2022


We sometimes hit the following assert when dumping a bad graph (before crashing with the bad graph assertion):

assert(real_LCA != NULL, "must always find an LCA"
``` 
The algorithm is not correct as we should always find an LCA of two nodes. To fix this, I've re-implemented the algorithm and improved the dumped idom chains:
- I limited the node dump to idx + node name to reduce the noise which made it hard to read.
- Reversed the idom chain dumps to reflect the graph structure.

Example output:

Bad graph detected in build_loop_late
n:  138  CastPP  === 205 38  [[ 263 140 140 168 ]]  #Test:NotNull *  Oop:Test:NotNull * !jvms: Test::mainTest @ bci:40 (line 154)

[... same output as before ...]

idoms of early "197 IfFalse":
idom[2]:    42  If
idom[1]:    44  IfTrue
idom[0]:   196  If
n:         197  IfFalse

idoms of (wrong) LCA "205 IfTrue":
idom[4]:    42  If
idom[3]:    37  Region
idom[2]:    73  If
idom[1]:    83  IfTrue
idom[0]:   204  If
n:         205  IfTrue

Real LCA of early "197 IfFalse" (idom[2]) and wrong LCA "205 IfTrue" (idom[4]):
  42  If  === 30 41  [[ 43 44 ]] P=0.999000, C=-1.000000 !jvms: Test::mainTest @ bci:32 (line 153)

Tested by manually calling `dump_idoms` during a compilation and by running reproducers of different bad graph assertion bugs.

Thanks,
Christian

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

Commit messages:
 - 8286800: Assert in PhaseIdealLoop::dump_real_LCA is too strong

Changes: https://git.openjdk.org/jdk/pull/11015/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11015&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8286800
  Stats: 131 lines in 2 files changed: 59 ins; 30 del; 42 mod
  Patch: https://git.openjdk.org/jdk/pull/11015.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/11015/head:pull/11015

PR: https://git.openjdk.org/jdk/pull/11015


More information about the hotspot-compiler-dev mailing list