RFR: 8347481: C2: Remove the control input of some nodes

Quan Anh Mai qamai at openjdk.org
Thu Jan 16 01:28:42 UTC 2025


On Wed, 15 Jan 2025 23:45:48 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:

>> I have thought about it and can't think of a reason for the control input. 
>> Firstly, the oop map is created after scheduling and should take care of this seemlessly.
>> Secondly, the control input does not prevent a CMoveP from moving down past a safepoint. And since these nodes have depends_only_on_test == true, they can be moved from a test to an equivalent dominating test, skipping any safepoint in between, which means these nodes can be moved up past a safepoint, too.
>> As a result, I don't think the control input of CMoveP and CMoveN is necessary and can be safely removed.
>
> Any undesireable performance effects if CMove node floats up beyond its (original) control? It may have changed on modern hardware, but my recollection is cmov instructions were quite expensive to execute.

@iwanowww A cmov is as cheap as an add so I don't think there will be any performance effect. I believe what you mean by cmov being expensive is that it has 1 cycle of latency on both of its inputs, while a well-predicted if diamond has 0 cycle of latency on the chosen input only.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23055#discussion_r1917540395


More information about the hotspot-compiler-dev mailing list