RFR: 8334647: C2: CastII added by PhaseIdealLoop::add_template_assertion_predicate() should have control [v2]

Christian Hagedorn chagedorn at openjdk.org
Mon Jun 24 10:36:26 UTC 2024


On Mon, 24 Jun 2024 09:52:24 GMT, Roland Westrelin <roland at openjdk.org> wrote:

>> `PhaseIdealLoop::add_template_assertion_predicate()` creates a new
>> `CastII` but doesn't set its control. I think it's good practice to
>> always set the control of a `CastII` when it narrows the type of its
>> input (it has to be control dependent on some condition that makes the
>> narrowing possible). This is also motivated by
>> https://bugs.openjdk.org/browse/JDK-8275202 where a node that becomes
>> top is used as an indication that control flow where the node changes
>> type can constant fold. This only works if control is set correctly.
>
> Roland Westrelin has updated the pull request incrementally with one additional commit since the last revision:
> 
>   review

Just thought about it again. What about ensuring that all `ConstraintCastNode` always set a control? I've had a quick look and it seems that we only have one `CastPP` where we do not set a control input. AFAICT, all other nodes set a control:

https://github.com/openjdk/jdk/blob/ca5a438e5a4612c66f70c70a9d425eca0e49e84d/src/hotspot/share/opto/vector.cpp#L491

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

PR Comment: https://git.openjdk.org/jdk/pull/19808#issuecomment-2186228979


More information about the hotspot-compiler-dev mailing list