RFR: 8308892: Bad graph detected in build_loop_late after JDK-8305635

Christian Hagedorn chagedorn at openjdk.org
Sun May 28 22:13:22 UTC 2023


The cleanup done in [JDK-8305635](https://bugs.openjdk.org/browse/JDK-8305635) wrongly identifies unrelated Parse Predicates which are not cleaned up, yet. It just walks from the entry of the loop up and tries to find each of the three Parse Predicates once but in no particular order. This order insensitive walk is wrong as seen in the following graph (from the attached replay file of this bug):

![image](https://github.com/openjdk/jdk/assets/17833009/32f73fcb-1d36-40d6-938c-2d282a98ea52)

We first find `116 Parse Predicate` for Loop Predicates, then `84 Parse Predicate` for Profiled Loop Predicates and then stop when finding `71 Parse Predicate` for Loop Predicates because we've already found a Parse Predicate for Loop Predicates already. We then wrongly create Loop Predicates (above `116 Parse Predicate`) which are below newly created Profiled Loop Predicates (above `84 Parse Predicate`). This could lead to a bad graph because of data dependencies that rely on the fact that Loop Predicates are above Profiled Loop Predicates:
https://github.com/openjdk/jdk/blob/547a8b40b324917e66c71409b31421feacce79d7/src/hotspot/share/opto/loopPredicate.cpp#L1529-L1543

The fix is straight forward to make the assignment of Parse Predicate projections in `ParsePredicates` aware of the relative ordering constraint. Note that this class will be refactored again in [JDK-8305636](https://bugs.openjdk.org/browse/JDK-8305636). But I think properly fixing this first is better than waiting for JDK-8305636 to go in.

Thanks,
Christian

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

Commit messages:
 - 8308892: Bad graph detected in build_loop_late after JDK-8305635

Changes: https://git.openjdk.org/jdk/pull/14196/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14196&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8308892
  Stats: 8 lines in 1 file changed: 6 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/14196.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/14196/head:pull/14196

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


More information about the hotspot-compiler-dev mailing list