RFR: 8331764: C2 SuperWord: refactor _align_to_ref/_mem_ref_for_main_loop_alignment

Emanuel Peter epeter at openjdk.org
Wed May 8 04:40:57 UTC 2024


On Tue, 7 May 2024 18:00:16 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:

>> This PR accomplishes these things:
>> - Rename `_align_to_ref` -> `_mem_ref_for_main_loop_alignment`.
>> - Move the `mem_ref` finding for alignment out of `SuperWord::find_adjacent_refs`. This is too early, and we don't even know if the relevant `mem_ref` is going to be vectorized. It makes more sense to pick a `mem_ref` directly in `SuperWord::adjust_pre_loop_limit_to_align_main_loop_vectors`, where we already know what packs are going to be vectorized.
>> - For the alignment width (aw), we can use the `vector_width` of the pack to which the `mem_ref` belongs, rather than the potentially much larger `vector_width_in_bytes`. I track this with `_aw_for_main_loop_alignment` now.
>> 
>> I need this for https://github.com/openjdk/jdk/pull/18822, and decided to split it out into an independent change.
>
> src/hotspot/share/opto/superword.cpp line 3407:
> 
>> 3405:     if (first == nullptr) { continue; }
>> 3406: 
>> 3407:     int vw = first->memory_size() * pack->size();
> 
> I assume `first` is verified already and `first->memory_size()` is reasonable (size of primitive type).

Yes, it is. All of this code is run in `SuperWord::output`, and at this point we are committed to vectorization - everything is verified.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19115#discussion_r1593373458


More information about the hotspot-compiler-dev mailing list