RFR: 8342043: Split Opaque4Node into OpaqueTemplateAssertionPredicateNode and OpaqueNotNullNode

Christian Hagedorn chagedorn at openjdk.org
Tue Oct 22 08:46:20 UTC 2024


On Tue, 22 Oct 2024 08:30:32 GMT, Roland Westrelin <roland at openjdk.org> wrote:

> > OpaqueTemplateAssertionPredicate is turned into a non-macro node and is removed after loop opts. At that point, loops can no longer be split and we do no need to create Initialized Assertion Predicates from the templates anymore. Thus, they can be cleaned up in the post loop opts IGVN.
> 
> The role of an assertion predicate is to catch an out of range input to a range check Cast or Conv nodes. If the `OpaqueTemplateAssertionPredicate` is removed after loop opts then you don't expect out of range values to appear after loop opts are over. But is it really the case? Why wouldn't an igvn later on not cause an out of range value? Also what's the benefit of changing when the opaque node is removed?

The `OpaqueTemplateAssertionPredicate` is only used for a Template Assertion Predicate from which we create new Initialized Assertion Predicates from when splitting a loop during loop opts, for example for Loop Peeling. When we no longer split loops, we do not need to create new Initialized Assertion Predicates anymore. So, we replace the `OpaqueTemplateAssertionPredicate` nodes with true to let the Template Assertion Predicates be folded away in the post loop opts IGVN round. However, the `OpaqueInitializedAssertionPredicate` nodes, which accompany the Initialized Assertion Predicates and make sure control is also folded away, will be kept and are only removed during macro node expansion (like the `Opaque4` nodes before).

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

PR Comment: https://git.openjdk.org/jdk/pull/21608#issuecomment-2428643955


More information about the hotspot-compiler-dev mailing list