RFR: 8353290: C2: Refactor PhaseIdealLoop::is_counted_loop() [v23]
Christian Hagedorn
chagedorn at openjdk.org
Tue Nov 25 15:31:52 UTC 2025
On Tue, 25 Nov 2025 15:00:11 GMT, Christian Hagedorn <chagedorn at openjdk.org> wrote:
>> Kangcheng Xu has updated the pull request incrementally with one additional commit since the last revision:
>>
>> fix trip counter loop-variant detection
>
> src/hotspot/share/opto/loopnode.cpp line 2572:
>
>> 2570: nphi = igvn->register_new_node_with_optimizer(nphi);
>> 2571: _phase->set_ctrl(nphi, _phase->get_ctrl(phi));
>> 2572: igvn->replace_node(_structure.phi(), nphi);
>
> You can use `phi` instead of fetching it again with `_structure.phi()`:
> Suggestion:
>
> Node* phi = _structure.phi();
> if (!TypeInteger::bottom(_iv_bt)->higher_equal(phi->bottom_type())) {
> Node* nphi =
> PhiNode::make(phi->in(0), phi->in(LoopNode::EntryControl), TypeInteger::bottom(_iv_bt));
> nphi->set_req(LoopNode::LoopBackControl, phi->in(LoopNode::LoopBackControl));
> nphi = igvn->register_new_node_with_optimizer(nphi);
> _phase->set_ctrl(nphi, _phase->get_ctrl(phi));
> igvn->replace_node(phi, nphi);
> phi = nphi->as_Phi();
> }
Maybe also rename `nphi` to `new_phi` to better distinguish `phi` from `nphi`.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24458#discussion_r2560327529
More information about the hotspot-compiler-dev
mailing list