RFR: 8283187: C2: loop candidate for superword not always unrolled fully if superword fails [v2]

Christian Hagedorn chagedorn at openjdk.java.net
Wed Mar 23 07:11:30 UTC 2022


On Tue, 22 Mar 2022 12:18:22 GMT, Roland Westrelin <roland at openjdk.org> wrote:

>> IdealLoopTree::policy_unroll_slp_analysis() restricts unrolling of
>> loops that are found to be candidate for superword but if superword
>> then fails, unrolling doesn't always resume. SuperWord::output() has
>> logic for that in one of the failure paths but some other paths are
>> not covered (for instance in the case of the test case). I propose
>> that superword explictly returns whether it succeeded or not and that
>> in case of failure, for a main loop, unrolling be attempted again.
>
> Roland Westrelin has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Update test/hotspot/jtreg/compiler/c2/irTests/TestSuperwordFailsUnrolling.java
>   
>   Co-authored-by: Tobias Hartmann <tobias.hartmann at oracle.com>

That looks good!

src/hotspot/share/opto/superword.cpp line 129:

> 127:   // skip any loop that has not been assigned max unroll by analysis
> 128:   if (do_optimization) {
> 129:     if (SuperWordLoopUnrollAnalysis && cl->slp_max_unroll() == 0) return false;

While at it, you could also add braces for the one liner ifs.

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

Marked as reviewed by chagedorn (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/7822


More information about the hotspot-compiler-dev mailing list