RFR: 8297951: C2: Create skeleton predicates for all If nodes in loop predication

Christian Hagedorn chagedorn at openjdk.org
Thu Dec 1 14:56:34 UTC 2022


We currently only create skeleton predicates for `RangeCheck` nodes and not for normal `If` nodes:
https://github.com/openjdk/jdk/blob/2cb64a75578ccc15a1dfc8c2843aa11d05ca8aa7/src/hotspot/share/opto/loopPredicate.cpp#L1344-L1346

But it is also possible to create range check predicates in loop predication for `If` nodes if they have the right pattern checked in `PhaseIdealLoop::loop_predication_impl()` and `IdealLoopTree::is_range_check_if()`. This, however, is much more rare.

Without skeleton predicates for these `If` nodes, we could run into the same problems already fixed for `RangeCheck` nodes (see [JDK-8193130](https://bugs.openjdk.org/browse/JDK-8193130) and related bugs). This is almost impossible to trigger in practice as it needs a very specific setup and the right optimizations to be applied. But the test case shows such a case where we hit an assert due to a broken memory graph because we are missing skeleton predicates.

I therefore propose to always create skeleton predicates for hoisted range checks in loop predication.

Thanks,
Christian

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

Commit messages:
 - Fix whitespaces
 - 8297951: C2: Create skeleton predicates for all If nodes in loop predication

Changes: https://git.openjdk.org/jdk/pull/11454/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11454&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8297951
  Stats: 85 lines in 2 files changed: 78 ins; 2 del; 5 mod
  Patch: https://git.openjdk.org/jdk/pull/11454.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/11454/head:pull/11454

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


More information about the hotspot-compiler-dev mailing list