RFR: 8307084: C2: Vectorized drain loop is not executed for some small trip counts [v4]
Fei Gao
fgao at openjdk.org
Tue Jan 20 11:24:57 UTC 2026
On Fri, 16 Jan 2026 09:42:57 GMT, Emanuel Peter <epeter at openjdk.org> wrote:
>> src/hotspot/share/opto/loopnode.hpp line 1440:
>>
>>> 1438: // result control flow branches
>>> 1439: // either to inner clone or outer
>>> 1440: // strip mined loop.
>>
>> I have trouble understanding the comments here (not your fault, it was here already).
>> I'm also wondering if this is only used for `post_loop`? If so, maybe we could rename it, and improve the comments here?
>
> At least in your code, it would read much better if it was called `InsertPost`
> I have trouble understanding the comments here (not your fault, it was here already). I'm also wondering if this is only used for `post_loop`? If so, maybe we could rename it, and improve the comments here?
`ControlAroundStripMined` is not used only for `post_loop`; it is also used by `do_peeling()` and `duplicate_loop_backedge()`. For that reason, I’m afraid renaming it to something like `InsertPost` wouldn’t be appropriate.
Based on my understanding, `ControlAroundStripMined` means that only the inner strip-mined loop is cloned, and a control-flow decision is inserted around the inner clone, allowing the exit control flow either to the inner clone or to the outer strip-mined loop.
How about refining the comments as follows:
...
ControlAroundStripMined = 2, // Only clone the inner strip-mined loop and insert
// control flow around it. Exit control flow
// branches either to inner clone or to the outer
// strip-mined loop.
InsertVectorizedDrain = 3 // Only clone the inner strip-mined vector loop and
// insert control flow that branches either to the
// cloned inner loop or to the scalar post loop.
...
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22629#discussion_r2705287124
More information about the hotspot-compiler-dev
mailing list