RFR: 8317723: C2: CountedLoopEndNodes and Zero Trip Guards are wrongly treated as Runtime Predicate
Christian Hagedorn
chagedorn at openjdk.org
Fri Nov 10 08:59:29 UTC 2023
In `testCountedLoopEndAsRuntimePredicate()`, a `CountedLoopEndNode` is wrongly treated as Runtime Predicate and added to a Predicate Block. This happens because a predicate trap ends up at one of the projections of the `CountedLoopEndNode` due to folding some other nodes:

The verification code then reports this failure when trying to find all predicates above `530 CountedLoop`. I've fixed `RuntimePredicate::is_success_proj()` to only treat an `IfNode` or a `RangeCheckNode` as Runtime Predicate.
We could also end up treating a zero trip guard If node with an `OpaqueZeroTripGuardNode` as Runtime Predicate (see `testZeroTripGuardAsRuntimePredicate()`):

This could also potentially lead to problems. I've improved `RuntimePredicate::is_success_proj()` to additionally exclude zero trip guard checks. I've strengthened the verification code accordingly such that it would have failed with `testZeroTripGuardAsRuntimePredicate()`.
Thanks,
Christian
-------------
Commit messages:
- 8317723: C2: CountedLoopEndNodes are wrongly treated as Runtime Predicate
Changes: https://git.openjdk.org/jdk/pull/16596/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=16596&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8317723
Stats: 132 lines in 5 files changed: 131 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/16596.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/16596/head:pull/16596
PR: https://git.openjdk.org/jdk/pull/16596
More information about the hotspot-compiler-dev
mailing list