RFR: 8307084: C2: Vectorized drain loop is not executed for some small trip counts [v4]
Emanuel Peter
epeter at openjdk.org
Fri Jan 16 09:22:16 UTC 2026
On Thu, 15 Jan 2026 16:50:51 GMT, Fei Gao <fgao at openjdk.org> wrote:
>> src/hotspot/share/opto/loopTransform.cpp line 1482:
>>
>>> 1480: pre_incr = clone_up_backedge_goo(nullptr, main_merge_region->in(1), pre_incr, visited, clones);
>>> 1481: }
>>> 1482: drain_input->set_req(1, pre_incr);
>>
>> Just a control question: above you did:
>> `drain_input = PhiNode::make(main_merge_region, iv_after_main);`
>> Does that not put `iv_after_main` at slot `1`, and now we overwrite it with `pre_incr`?
>
> Yes, this is what we're generating:
> `drain_input = merge (pre_incr, iv_after_main)`
Ah, I think you are right. `PhiNode::make` does something I did not expect: it creates a Phi that has as many slots for merging as the region, and puts the specified value in ALL slots. So at first we get:
`Phi(self, iv_after_main, iv_after_main)`
And after `set_req`, we then have:
`Phi(self, pre_incr, iv_after_main)`
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22629#discussion_r2697612719
More information about the hotspot-compiler-dev
mailing list