RFR: 8326962: C2 SuperWord: cache VPointer [v4]

Christian Hagedorn chagedorn at openjdk.org
Wed Apr 3 06:46:10 UTC 2024


On Tue, 2 Apr 2024 15:42:04 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> src/hotspot/share/opto/vectorization.cpp line 224:
>> 
>>> 222:   for (int i = 0; i < _body.body().length(); i++) {
>>> 223:     MemNode* mem = _body.body().at(i)->isa_Mem();
>>> 224:     if (mem != nullptr && _vloop.in_bb(mem)) {
>> 
>> I see that you use this pattern twice. Maybe we could provide a "for_each_mem(lambda)" in `VLoopBody`? But could also be done separately.
>
> I was considering it. I can do that.

Can now also be replaced by `for_each_mem()`.

>> src/hotspot/share/opto/vectorization.hpp line 462:
>> 
>>> 460:   const VLoopBody&         _body;
>>> 461: 
>>> 462:   // Array of cached pointers
>> 
>> Maybe make a note that we allocate/cache them lazily upon request.
>
> It is not lazy, they are allocated and cached in `compute_and_cache`. Like all other `VLoopAnalyzer` submodules. Maybe I missed your point 😅

I've meant that it's not allocated in the constructor as you initialize it with `nullptr`. It's only initialized once you call `compute_and_cache()` which may not happen if we bail out earlier. That's what I've meant with "lazy" but that was probably not clear enough :-)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18577#discussion_r1548999383
PR Review Comment: https://git.openjdk.org/jdk/pull/18577#discussion_r1548997542


More information about the hotspot-compiler-dev mailing list