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

Emanuel Peter epeter at openjdk.org
Wed Nov 15 14:25:30 UTC 2023


On Wed, 15 Nov 2023 13:53:05 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
>
> Christian Hagedorn has updated the pull request incrementally with one additional commit since the last revision:
> 
>   update zero trip guard check code

Marked as reviewed by epeter (Reviewer).

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

PR Review: https://git.openjdk.org/jdk/pull/16596#pullrequestreview-1732145998


More information about the hotspot-compiler-dev mailing list