RFR: 8308892: Bad graph detected in build_loop_late after JDK-8305635
Christian Hagedorn
chagedorn at openjdk.org
Tue May 30 08:34:54 UTC 2023
On Sun, 28 May 2023 22:06:42 GMT, Christian Hagedorn <chagedorn at openjdk.org> wrote:
> 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):
>
> 
>
> 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.
>
> Testing: tier1-4, hs-precheckin-comp, hs-stress-comp
>
> Thanks,
> Christian
After the first IGVN round, after parsing, they become useless because the `If` that triggered the insertion of the predicates with `maybe_add_predicate_after_if()` is folded away. I think it's unfortunate, though, that we eliminate `71 Parse Predicate` and `84 Parse Predicate` instead of `116 Parse Predicate` (so, we cannot add profiled loop predicates anymore). But that might be an edge case.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/14196#issuecomment-1568000839
More information about the hotspot-compiler-dev
mailing list