RFR: 8350756: C2 SuperWord Multiversioning: remove useless slow loop when the fast loop disappears [v7]

Emanuel Peter epeter at openjdk.org
Wed Mar 5 07:05:56 UTC 2025


On Tue, 4 Mar 2025 18:47:00 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:

>> Emanuel Peter has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   pre loop not reliably folded, adapt IR rule
>
> src/hotspot/share/opto/loopnode.cpp line 4566:
> 
>> 4564:     if (lpt->_child == nullptr && lpt->is_counted()) {
>> 4565:       CountedLoopNode* head = lpt->_head->as_CountedLoop();
>> 4566:       if (head->is_main_loop() && head->is_multiversion_fast_loop()) {
> 
> Can any other than `main` loop marked as `is_multiversion_fast_loop`?

Yes!
See the attached test's IR rule:

    @IR(counts = {"pre .* multiversion_fast",  "= 2", // regular pre-main-post for both loops
                  "main .* multiversion_fast", "= 2",
                  "post .* multiversion_fast", "= 2",
                  "multiversion_delayed_slow", "= 2", // both have the delayed slow_loop
                  "multiversion",              "= 8", // nothing unexpected
                  IRNode.OPAQUE_MULTIVERSIONING, "= 2"}, // Both multiversion_if are still here


I'll add a comment to the code for more explanation :)

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/23865#discussion_r1980815226


More information about the hotspot-compiler-dev mailing list