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

Pengfei Li pli at openjdk.org
Tue Aug 29 01:35:44 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 with a new target base due to a merge or a rebase. The pull request now contains two commits:

 - Merge branch 'master' into swpointer
 - 8312332: C2: Refactor SWPointer out from SuperWord
   
   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.

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

Changes: https://git.openjdk.org/jdk/pull/15013/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=15013&range=01
  Stats: 1924 lines in 7 files changed: 967 ins; 909 del; 48 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