RFR: 8347481: C2: Remove the control input of some nodes
Vladimir Ivanov
vlivanov at openjdk.org
Wed Jan 15 23:48:47 UTC 2025
On Wed, 15 Jan 2025 22:18:13 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:
>> src/hotspot/share/opto/movenode.hpp line 90:
>>
>>> 88: class CMovePNode : public CMoveNode {
>>> 89: public:
>>> 90: CMovePNode(Node* bol, Node* left, Node* right, const TypePtr* t) : CMoveNode(bol, left, right, t) {}
>>
>> I looked on history and this control setting was added at the very beginning.
>> May be it was done to avoid bypassing safepoints where oops could be modified (objects moved) and result of `CMoveP` before and after safepoint will be different.
>> I would be careful about changing it and `CMoveN`.
>
> 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.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23055#discussion_r1917480208
More information about the hotspot-compiler-dev
mailing list