RFR: 8350578: Refactor useless Parse and Template Assertion Predicate elimination code by using a PredicateVisitor [v2]

Christian Hagedorn chagedorn at openjdk.org
Fri Mar 14 12:17:52 UTC 2025


On Fri, 14 Mar 2025 12:02:10 GMT, Galder Zamarreño <galder at openjdk.org> wrote:

>> When iterating through predicates, we use a `PredicateBlockIterator` for each Predicate Block, which consists of an optional Parse Predicate and a number of Regular Predicates (Runtime and Assertion Predicates). We could have either already removed the Parse Predicate before here:
>> https://github.com/openjdk/jdk/blob/e3c29c9e6cff7648952c0ba359b0763a0ea8da18/src/hotspot/share/opto/loopnode.cpp#L5055-L5066
>> 
>> or there is just no Parse Predicate for this loop. So, when initializing the `PredicateBlockIterator`, we could pass here a non-Parse-Predicate projection to the constructor of `ParsePredicate`:
>> https://github.com/openjdk/jdk/blob/e3c29c9e6cff7648952c0ba359b0763a0ea8da18/src/hotspot/share/opto/predicates.hpp#L747
>> 
>> We then set `_parse_predicate_node` to null here due to this mismatch:
>> https://github.com/openjdk/jdk/blob/e3c29c9e6cff7648952c0ba359b0763a0ea8da18/src/hotspot/share/opto/predicates.hpp#L293-L296
>
> Is the last code snippet the relevant one?

Sorry, I copy-pasted the wrong snippet. The null is coming from here:
https://github.com/openjdk/jdk/blob/e3c29c9e6cff7648952c0ba359b0763a0ea8da18/src/hotspot/share/opto/predicates.cpp#L71-L82

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24013#discussion_r1995447225


More information about the hotspot-compiler-dev mailing list