RFR: 8312332: C2: Refactor SWPointer out from SuperWord

Emanuel Peter epeter at openjdk.org
Thu Aug 10 12:38:29 UTC 2023


On Thu, 10 Aug 2023 11:50:12 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> As discussed in JDK-8308994, we should first do some refactoring work before proceeding with the new post loop vectorization. In this patch, we have done the following.
>> 
>> 1) We have created new C2 source files `vectorization.[cpp|hpp]` for shared logics and utilities for C2's auto-vectorization. So far we have moved class `SWPointer` and `VectorElementSizeStats` here from `superword.[cpp|hpp]`.
>> 
>> 2) We have decoupled `SWPointer` from class `SuperWord` and renamed it to `VPointer` as it will be used by vectorizers other than SuperWord. The original class `SWPointer` and its inner class `Tracer` both have a `_slp` field initialized in their constructors. In this patch, we have replaced them by other fields and re-written the constructors for the same functionality. Original `SWPointer::invariant()` calls function `SuperWord::find_pre_loop_end()` for loop invariant checks. To help decoupling, we moved function `find_pre_loop_end()` to class `CountedLoopNode`. As function `SWPointer::Tracer::invariant_1()` is tightly coupled with `SuperWord` but only prints some debug messages, we temporarily removed it in this patch. We will consider adding it back after later refactoring of `SuperWord` so we added a `TODO` at its call site in this patch.
>> 
>> 3) We have a lot of memory phi node checks in loop optimizations. So we added a utility function `is_memory_phi()` in `node.hpp`.
>> 
>> Tested tier1~3 on x86 and AArch64. Also manually verified that option `VectorizeDebug` in compiler directives still works well.
>
> src/hotspot/share/opto/vectorization.cpp line 131:
> 
>> 129: bool VPointer::invariant(Node* n) const {
>> 130:   NOT_PRODUCT(Tracer::Depth dd;)
>> 131:   // TODO: Add more trace output for invariant check after later refactoring
> 
> We generally don't like `TODO`s in the code. Best is to just drop it in the code and file an RFE if you think it is really important.
> 
> When did this even trace anything?
> `_slp->_lpt->is_member(_slp->_phase->get_loop(n_c)) != (int)_slp->in_bb(n)`
> 
> Do you think this tracing is relevant enough?

If it should never happen: can we add an assert somewhere instead?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15013#discussion_r1290044129


More information about the hotspot-compiler-dev mailing list