RFR: 8347481: C2: Remove the control input of some nodes
Quan Anh Mai
qamai at openjdk.org
Wed Jan 15 22:20:35 UTC 2025
On Wed, 15 Jan 2025 18:24:47 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:
>> Hi,
>>
>> While working on [JDK-8347365](https://bugs.openjdk.org/browse/JDK-8347365), I noticed that there are some nodes that have their control inputs being set in a seemingly erroneous manner. This patch removes the control inputs for those nodes.
>>
>> Please review this PR, thanks a lot.
>
> 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.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23055#discussion_r1917407606
More information about the hotspot-compiler-dev
mailing list