RFR: 8312332: C2: Refactor SWPointer out from SuperWord [v3]

Pengfei Li pli at openjdk.org
Wed Aug 30 11:28:56 UTC 2023


> 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.

Pengfei Li has updated the pull request incrementally with one additional commit since the last revision:

  Move the cache of _pre_loop_end to CountedLoopNode

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/15013/files
  - new: https://git.openjdk.org/jdk/pull/15013/files/c6cbec36..0ca709ef

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=15013&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=15013&range=01-02

  Stats: 61 lines in 5 files changed: 27 ins; 25 del; 9 mod
  Patch: https://git.openjdk.org/jdk/pull/15013.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/15013/head:pull/15013

PR: https://git.openjdk.org/jdk/pull/15013


More information about the hotspot-compiler-dev mailing list