RFR: 8317723: C2: CountedLoopEndNodes and Zero Trip Guards are wrongly treated as Runtime Predicate

Christian Hagedorn chagedorn at openjdk.org
Wed Nov 15 13:53:06 UTC 2023


On Fri, 10 Nov 2023 08:53:29 GMT, Christian Hagedorn <chagedorn at openjdk.org> wrote:

> 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:
> 
> ![image](https://github.com/openjdk/jdk/assets/17833009/d00af4aa-e962-454f-b7cd-5984dfda293f)
> 
> 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()`):
> 
> ![image](https://github.com/openjdk/jdk/assets/17833009/a515bdfb-b599-4a81-902c-e85b980f5899)
> 
> 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

Thanks Tobias and Emanuel for your review! I've pushed an update with the review suggestion.

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

PR Comment: https://git.openjdk.org/jdk/pull/16596#issuecomment-1812568125


More information about the hotspot-compiler-dev mailing list