[V2,00/14] Refactor and cleanup vsetvl pass

Message ID 20231017113500.1160997-1-lehua.ding@rivai.ai
Headers
Series Refactor and cleanup vsetvl pass |

Message

Lehua Ding Oct. 17, 2023, 11:34 a.m. UTC
  This patch refactors and cleanups the vsetvl pass in order to make the code
easier to modify and understand. This patch does several things:

1. Introducing a virtual CFG for vsetvl infos and Phase 1, 2 and 3 only maintain
   and modify this virtual CFG. Phase 4 performs insertion, modification and
   deletion of vsetvl insns based on the virtual CFG. The Basic block in the
   virtual CFG is called vsetvl_block_info and the vsetvl information inside
   is called vsetvl_info.
2. Combine Phase 1 and 2 into a single Phase 1 and unified the demand system,
   this Phase only fuse local vsetvl info in forward direction.
3. Refactor Phase 3, change the logic for determining whether to uplift vsetvl
   info to a pred basic block to a more unified method that there is a vsetvl
   info in the vsetvl defintion reaching in compatible with it.
4. Place all modification operations to the RTL in Phase 4 and Phase 5.
   Phase 4 is responsible for inserting, modifying and deleting vsetvl
   instructions based on fully optimized vsetvl infos. Phase 5 removes the avl
   operand from the RVV instruction and removes the unused dest operand
   register from the vsetvl insns.

These modifications resulted in some testcases needing to be updated. The reasons
for updating are summarized below:

1. more optimized
   vlmax_back_prop-25.c/vlmax_back_prop-26.c/vlmax_conflict-3.c/
   vlmax_conflict-12.c/vsetvl-13.c/vsetvl-23.c/
   avl_single-23.c/avl_single-89.c/avl_single-95.c/pr109773-1.c
2. less unnecessary fusion
   avl_single-46.c/imm_bb_prop-1.c/pr109743-2.c/vsetvl-18.c
3. local fuse direction (backward -> forward)
   scalar_move-1.c/
4. add some bugfix testcases.
   pr111037-3.c/pr111037-4.c
   avl_single-89.c

	PR target/111037
	PR target/111234
	PR target/111725


Lehua Ding (14):
  RISC-V: P1: Refactor avl_info/vl_vtype_info/vector_insn_info
  RISC-V: P2: Refactor and cleanup demand system
  RISC-V: P3: Refactor class vector_infos_manager to pre_vsetvl
  RISC-V: P4: move method from class pass_vsetvl to pre_vsetvl
  RISC-V: P5: combine phase 1 and 2 into a single pahse
  RISC-V: P6: Add compute reaching definition data flow
  RISC-V: P7: Move earliest fuse and lcm code to pre_vsetvl class
  RISC-V: P8: Unified insert and delete of vsetvl insn into Phase 4
  RISC-V: P9: Cleanup post optimize phase
  RISC-V: P10: Cleanup helper functions
  RISC-V: P11:  Refactor vector_block_info to vsetvl_block_info class
  RISC-V: P12: Delete riscv-vsetvl.h
  RISC-V: P13:  Reorganize functions used to modify RTL
  RISC-V: P14: Adjust and add testcases

 gcc/config/riscv/riscv-vsetvl.cc              | 6530 +++++++----------
 gcc/config/riscv/riscv-vsetvl.def             |  634 +-
 gcc/config/riscv/riscv-vsetvl.h               |  488 --
 gcc/config/riscv/t-riscv                      |    2 +-
 .../gcc.target/riscv/rvv/base/pr111037-2.c    |    8 -
 .../gcc.target/riscv/rvv/base/scalar_move-1.c |    2 +-
 .../riscv/rvv/vsetvl/avl_single-104.c         |   35 +
 .../riscv/rvv/vsetvl/avl_single-105.c         |   23 +
 .../riscv/rvv/vsetvl/avl_single-23.c          |    7 +-
 .../riscv/rvv/vsetvl/avl_single-46.c          |    3 +-
 .../riscv/rvv/vsetvl/avl_single-89.c          |    8 +-
 .../riscv/rvv/vsetvl/avl_single-95.c          |    2 +-
 .../riscv/rvv/vsetvl/imm_bb_prop-1.c          |    7 +-
 .../gcc.target/riscv/rvv/vsetvl/pr109743-2.c  |    2 +-
 .../gcc.target/riscv/rvv/vsetvl/pr109773-1.c  |    2 +-
 .../gcc.target/riscv/rvv/vsetvl/pr111037-3.c  |   16 +
 .../pr111037-1.c => vsetvl/pr111037-4.c}      |    5 +-
 .../riscv/rvv/vsetvl/vlmax_back_prop-25.c     |   10 +-
 .../riscv/rvv/vsetvl/vlmax_back_prop-26.c     |   10 +-
 .../riscv/rvv/vsetvl/vlmax_conflict-12.c      |    1 -
 .../riscv/rvv/vsetvl/vlmax_conflict-3.c       |    2 +-
 .../gcc.target/riscv/rvv/vsetvl/vsetvl-13.c   |    4 +-
 .../gcc.target/riscv/rvv/vsetvl/vsetvl-18.c   |    4 +-
 .../gcc.target/riscv/rvv/vsetvl/vsetvl-23.c   |    2 +-
 24 files changed, 3084 insertions(+), 4723 deletions(-)
 delete mode 100644 gcc/config/riscv/riscv-vsetvl.h
 delete mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/pr111037-2.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-104.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-105.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111037-3.c
 rename gcc/testsuite/gcc.target/riscv/rvv/{base/pr111037-1.c => vsetvl/pr111037-4.c} (74%)

--
2.36.3
  

Comments

Patrick O'Neill Oct. 17, 2023, 8:25 p.m. UTC | #1
Hi Lehua!

I ran the gcc testsuite on qemu before/after applying your patches to 
305034e3 rv32/64gcv [1].

Baseline
                ========= Summary of gcc testsuite =========
                             | # of unexpected case / # of unique 
unexpected case
                             |          gcc |          g++ | gfortran |
     rv32gcv/ ilp32d/ medlow |  208 /    78 |   29 /    17 |   71 /    24 |
     rv64gcv/  lp64d/ medlow |  101 /    54 |   13 /     4 |   33 /    13 |

After applying patch series:
                ========= Summary of gcc testsuite =========
                             | # of unexpected case / # of unique 
unexpected case
                             |          gcc |          g++ | gfortran |
     rv32gcv/ ilp32d/ medlow |  256 /    96 |   29 /    17 |   69 /    23 |
     rv64gcv/  lp64d/ medlow |  152 /    74 |   13 /     4 |   31 /    12 |

I'm seeing:
20 new unique gcc failures on rv64gcv [2]
18 new unique gcc failures on rv32gcv [3]

Thanks,
Patrick

[1] Build commands:
git clone https://github.com/patrick-rivos/riscv-gnu-toolchain.git
cd riscv-gnu-toolchain
git submodule update --init gcc
cd gcc
git checkout 305034e3
cd ..
mkdir build
cd build
../configure --prefix=$(pwd) 
--with-multilib-generator="rv64gcv-lp64d--;rv32gcv-ilp32d--"
make report-linux -j32

Note: If you'd prefer to use upstream riscv-gnu-toolchain, I'm pretty 
sure you can do
mkdir build-64
cd build-64
../configure --prefix=$(pwd) --with-arch=rv64gcv --with-abi=lp64d
cd ..
mkdir build-32
cd build-32
../configure --prefix=$(pwd) --with-arch=rv32gcv --with-abi=lp32d
This'll make 2 folders, so run make report-linux in each of them.

[2] rv64gcv New failures:
FAIL: gcc.dg/vect/slp-7.c -flto -ffat-lto-objects execution test
FAIL: gcc.dg/vect/slp-7.c execution test
FAIL: gcc.target/riscv/zero-scratch-regs-2.c   -O3 -g scan-assembler-not 
\\mvsetvli
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O1 
scan-assembler-times vsetvli 1
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 
scan-assembler-times vsetvli 1
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 -flto 
-fno-use-linker-plugin -flto-partition=none   scan-assembler-times vsetvli 1
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 -flto 
-fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 1
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -Os 
scan-assembler-times vsetvli 1
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O1 
scan-assembler-times vsetvli 3
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O2 
scan-assembler-times vsetvli 3
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O2 -flto 
-fno-use-linker-plugin -flto-partition=none   scan-assembler-times vsetvli 3
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O2 -flto 
-fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 3
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -Os 
scan-assembler-times vsetvli 3
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O1 
scan-assembler-times vsetvli 4
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O2 
scan-assembler-times vsetvli 4
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O2 -flto 
-fno-use-linker-plugin -flto-partition=none   scan-assembler-times vsetvli 4
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O2 -flto 
-fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 4
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O1 
scan-assembler-times vsetvli 2
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O2 
scan-assembler-times vsetvli 2
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O2 -flto 
-fno-use-linker-plugin -flto-partition=none   scan-assembler-times vsetvli 2
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O2 -flto 
-fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 2
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -Os 
scan-assembler-times vsetvli 2
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O1 
scan-assembler-times vsetvli 2
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O2 
scan-assembler-times vsetvli 2
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O2 -flto 
-fno-use-linker-plugin -flto-partition=none   scan-assembler-times vsetvli 2
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O2 -flto 
-fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 2
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O1 
scan-assembler-times vsetvli 2
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O2 
scan-assembler-times vsetvli 2
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O2 -flto 
-fno-use-linker-plugin -flto-partition=none   scan-assembler-times vsetvli 2
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O2 -flto 
-fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 2
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -Os 
scan-assembler-times vsetvli 2
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-65.c   -O2 
scan-assembler-times vsetvli 3
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-65.c   -O2 -flto 
-fno-use-linker-plugin -flto-partition=none   scan-assembler-times vsetvli 3
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-65.c   -O2 -flto 
-fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 3
FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O0 scan-assembler-not 
vsetvli
FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O1 scan-assembler-not 
vsetvli
FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2 scan-assembler-not 
vsetvli
FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2 -flto 
-fno-use-linker-plugin -flto-partition=none   scan-assembler-not vsetvli
FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2 -flto 
-fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-not vsetvli
FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O3 -g 
scan-assembler-not vsetvli
FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -Os scan-assembler-not 
vsetvli
FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-10.c   -O3 -g   
scan-assembler-times vsetvli 15
FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-11.c   -O3 -g   
scan-assembler-times vsetvli 3
FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-12.c   -O3 -g   
scan-assembler-times vsetvli 9
FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-13.c   -O3 -g   
scan-assembler-times vsetvli 9
FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-14.c   -O3 -g   
scan-assembler-times vsetvli 1
FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-15.c   -O3 -g   
scan-assembler-times vsetvli 4
FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-16.c   -O3 -g   
scan-assembler-times vsetvli 15
FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-18.c   -O3 -g   
scan-assembler-times vsetvli 3
FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-19.c   -O3 -g   
scan-assembler-times vsetvli 15
FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-9.c   -O3 -g   
scan-assembler-times vsetvli 15

[3] rv32gcv New failures:
FAIL: gcc.target/riscv/zero-scratch-regs-2.c   -O3 -g scan-assembler-not 
\\mvsetvli
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O1 
scan-assembler-times vsetvli 1
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 
scan-assembler-times vsetvli 1
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 -flto 
-fno-use-linker-plugin -flto-partition=none   scan-assembler-times vsetvli 1
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 -flto 
-fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 1
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -Os 
scan-assembler-times vsetvli 1
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O1 
scan-assembler-times vsetvli 3
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O2 
scan-assembler-times vsetvli 3
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O2 -flto 
-fno-use-linker-plugin -flto-partition=none   scan-assembler-times vsetvli 3
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O2 -flto 
-fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 3
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -Os 
scan-assembler-times vsetvli 3
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O1 
scan-assembler-times vsetvli 4
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O2 
scan-assembler-times vsetvli 4
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O2 -flto 
-fno-use-linker-plugin -flto-partition=none   scan-assembler-times vsetvli 4
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O2 -flto 
-fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 4
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O1 
scan-assembler-times vsetvli 2
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O2 
scan-assembler-times vsetvli 2
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O2 -flto 
-fno-use-linker-plugin -flto-partition=none   scan-assembler-times vsetvli 2
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O2 -flto 
-fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 2
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -Os 
scan-assembler-times vsetvli 2
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O1 
scan-assembler-times vsetvli 2
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O2 
scan-assembler-times vsetvli 2
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O2 -flto 
-fno-use-linker-plugin -flto-partition=none   scan-assembler-times vsetvli 2
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O2 -flto 
-fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 2
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O1 
scan-assembler-times vsetvli 2
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O2 
scan-assembler-times vsetvli 2
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O2 -flto 
-fno-use-linker-plugin -flto-partition=none   scan-assembler-times vsetvli 2
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O2 -flto 
-fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 2
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -Os 
scan-assembler-times vsetvli 2
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-65.c   -O2 
scan-assembler-times vsetvli 3
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-65.c   -O2 -flto 
-fno-use-linker-plugin -flto-partition=none   scan-assembler-times vsetvli 3
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-65.c   -O2 -flto 
-fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 3
FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O0 scan-assembler-not 
vsetvli
FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O1 scan-assembler-not 
vsetvli
FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2 scan-assembler-not 
vsetvli
FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2 -flto 
-fno-use-linker-plugin -flto-partition=none   scan-assembler-not vsetvli
FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2 -flto 
-fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-not vsetvli
FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O3 -g 
scan-assembler-not vsetvli
FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -Os scan-assembler-not 
vsetvli
FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-10.c   -O3 -g   
scan-assembler-times vsetvli 15
FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-11.c   -O3 -g   
scan-assembler-times vsetvli 3
FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-12.c   -O3 -g   
scan-assembler-times vsetvli 9
FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-13.c   -O3 -g   
scan-assembler-times vsetvli 9
FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-14.c   -O3 -g   
scan-assembler-times vsetvli 1
FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-15.c   -O3 -g   
scan-assembler-times vsetvli 4
FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-16.c   -O3 -g   
scan-assembler-times vsetvli 15
FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-18.c   -O3 -g   
scan-assembler-times vsetvli 3
FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-19.c   -O3 -g   
scan-assembler-times vsetvli 15
FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-9.c   -O3 -g   
scan-assembler-times vsetvli 15

On 10/17/23 04:34, Lehua Ding wrote:
> This patch refactors and cleanups the vsetvl pass in order to make the code
> easier to modify and understand. This patch does several things:
>
> 1. Introducing a virtual CFG for vsetvl infos and Phase 1, 2 and 3 only maintain
>     and modify this virtual CFG. Phase 4 performs insertion, modification and
>     deletion of vsetvl insns based on the virtual CFG. The Basic block in the
>     virtual CFG is called vsetvl_block_info and the vsetvl information inside
>     is called vsetvl_info.
> 2. Combine Phase 1 and 2 into a single Phase 1 and unified the demand system,
>     this Phase only fuse local vsetvl info in forward direction.
> 3. Refactor Phase 3, change the logic for determining whether to uplift vsetvl
>     info to a pred basic block to a more unified method that there is a vsetvl
>     info in the vsetvl defintion reaching in compatible with it.
> 4. Place all modification operations to the RTL in Phase 4 and Phase 5.
>     Phase 4 is responsible for inserting, modifying and deleting vsetvl
>     instructions based on fully optimized vsetvl infos. Phase 5 removes the avl
>     operand from the RVV instruction and removes the unused dest operand
>     register from the vsetvl insns.
>
> These modifications resulted in some testcases needing to be updated. The reasons
> for updating are summarized below:
>
> 1. more optimized
>     vlmax_back_prop-25.c/vlmax_back_prop-26.c/vlmax_conflict-3.c/
>     vlmax_conflict-12.c/vsetvl-13.c/vsetvl-23.c/
>     avl_single-23.c/avl_single-89.c/avl_single-95.c/pr109773-1.c
> 2. less unnecessary fusion
>     avl_single-46.c/imm_bb_prop-1.c/pr109743-2.c/vsetvl-18.c
> 3. local fuse direction (backward -> forward)
>     scalar_move-1.c/
> 4. add some bugfix testcases.
>     pr111037-3.c/pr111037-4.c
>     avl_single-89.c
>
> 	PR target/111037
> 	PR target/111234
> 	PR target/111725
>
>
> Lehua Ding (14):
>    RISC-V: P1: Refactor avl_info/vl_vtype_info/vector_insn_info
>    RISC-V: P2: Refactor and cleanup demand system
>    RISC-V: P3: Refactor class vector_infos_manager to pre_vsetvl
>    RISC-V: P4: move method from class pass_vsetvl to pre_vsetvl
>    RISC-V: P5: combine phase 1 and 2 into a single pahse
>    RISC-V: P6: Add compute reaching definition data flow
>    RISC-V: P7: Move earliest fuse and lcm code to pre_vsetvl class
>    RISC-V: P8: Unified insert and delete of vsetvl insn into Phase 4
>    RISC-V: P9: Cleanup post optimize phase
>    RISC-V: P10: Cleanup helper functions
>    RISC-V: P11:  Refactor vector_block_info to vsetvl_block_info class
>    RISC-V: P12: Delete riscv-vsetvl.h
>    RISC-V: P13:  Reorganize functions used to modify RTL
>    RISC-V: P14: Adjust and add testcases
>
>   gcc/config/riscv/riscv-vsetvl.cc              | 6530 +++++++----------
>   gcc/config/riscv/riscv-vsetvl.def             |  634 +-
>   gcc/config/riscv/riscv-vsetvl.h               |  488 --
>   gcc/config/riscv/t-riscv                      |    2 +-
>   .../gcc.target/riscv/rvv/base/pr111037-2.c    |    8 -
>   .../gcc.target/riscv/rvv/base/scalar_move-1.c |    2 +-
>   .../riscv/rvv/vsetvl/avl_single-104.c         |   35 +
>   .../riscv/rvv/vsetvl/avl_single-105.c         |   23 +
>   .../riscv/rvv/vsetvl/avl_single-23.c          |    7 +-
>   .../riscv/rvv/vsetvl/avl_single-46.c          |    3 +-
>   .../riscv/rvv/vsetvl/avl_single-89.c          |    8 +-
>   .../riscv/rvv/vsetvl/avl_single-95.c          |    2 +-
>   .../riscv/rvv/vsetvl/imm_bb_prop-1.c          |    7 +-
>   .../gcc.target/riscv/rvv/vsetvl/pr109743-2.c  |    2 +-
>   .../gcc.target/riscv/rvv/vsetvl/pr109773-1.c  |    2 +-
>   .../gcc.target/riscv/rvv/vsetvl/pr111037-3.c  |   16 +
>   .../pr111037-1.c => vsetvl/pr111037-4.c}      |    5 +-
>   .../riscv/rvv/vsetvl/vlmax_back_prop-25.c     |   10 +-
>   .../riscv/rvv/vsetvl/vlmax_back_prop-26.c     |   10 +-
>   .../riscv/rvv/vsetvl/vlmax_conflict-12.c      |    1 -
>   .../riscv/rvv/vsetvl/vlmax_conflict-3.c       |    2 +-
>   .../gcc.target/riscv/rvv/vsetvl/vsetvl-13.c   |    4 +-
>   .../gcc.target/riscv/rvv/vsetvl/vsetvl-18.c   |    4 +-
>   .../gcc.target/riscv/rvv/vsetvl/vsetvl-23.c   |    2 +-
>   24 files changed, 3084 insertions(+), 4723 deletions(-)
>   delete mode 100644 gcc/config/riscv/riscv-vsetvl.h
>   delete mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/pr111037-2.c
>   create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-104.c
>   create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-105.c
>   create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111037-3.c
>   rename gcc/testsuite/gcc.target/riscv/rvv/{base/pr111037-1.c => vsetvl/pr111037-4.c} (74%)
>
> --
> 2.36.3
>
  
Lehua Ding Oct. 18, 2023, 2:20 a.m. UTC | #2
Hi Patrick,

Thanks a lot for reporting these failes, very important. I'll locate the 
causes since my previous run was with these parameters: 
-march=gcv_zvfh_zfh + -cmodel=medany + spike did not encounter these fails.

On 2023/10/18 4:25, Patrick O'Neill wrote:
> Hi Lehua!
> 
> I ran the gcc testsuite on qemu before/after applying your patches to 
> 305034e3 rv32/64gcv [1].
> 
> Baseline
>                 ========= Summary of gcc testsuite =========
>                              | # of unexpected case / # of unique 
> unexpected case
>                              |          gcc |          g++ | gfortran |
>      rv32gcv/ ilp32d/ medlow |  208 /    78 |   29 /    17 |   71 /    24 |
>      rv64gcv/  lp64d/ medlow |  101 /    54 |   13 /     4 |   33 /    13 |
> 
> After applying patch series:
>                 ========= Summary of gcc testsuite =========
>                              | # of unexpected case / # of unique 
> unexpected case
>                              |          gcc |          g++ | gfortran |
>      rv32gcv/ ilp32d/ medlow |  256 /    96 |   29 /    17 |   69 /    23 |
>      rv64gcv/  lp64d/ medlow |  152 /    74 |   13 /     4 |   31 /    12 |
> 
> I'm seeing:
> 20 new unique gcc failures on rv64gcv [2]
> 18 new unique gcc failures on rv32gcv [3]
> 
> Thanks,
> Patrick
> 
> [1] Build commands:
> git clone https://github.com/patrick-rivos/riscv-gnu-toolchain.git
> cd riscv-gnu-toolchain
> git submodule update --init gcc
> cd gcc
> git checkout 305034e3
> cd ..
> mkdir build
> cd build
> ../configure --prefix=$(pwd) 
> --with-multilib-generator="rv64gcv-lp64d--;rv32gcv-ilp32d--"
> make report-linux -j32
> 
> Note: If you'd prefer to use upstream riscv-gnu-toolchain, I'm pretty 
> sure you can do
> mkdir build-64
> cd build-64
> ../configure --prefix=$(pwd) --with-arch=rv64gcv --with-abi=lp64d
> cd ..
> mkdir build-32
> cd build-32
> ../configure --prefix=$(pwd) --with-arch=rv32gcv --with-abi=lp32d
> This'll make 2 folders, so run make report-linux in each of them.
> 
> [2] rv64gcv New failures:
> FAIL: gcc.dg/vect/slp-7.c -flto -ffat-lto-objects execution test
> FAIL: gcc.dg/vect/slp-7.c execution test
> FAIL: gcc.target/riscv/zero-scratch-regs-2.c   -O3 -g scan-assembler-not 
> \\mvsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O1 
> scan-assembler-times vsetvli 1
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 
> scan-assembler-times vsetvli 1
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 1
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 1
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -Os 
> scan-assembler-times vsetvli 1
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O1 
> scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O2 
> scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -Os 
> scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O1 
> scan-assembler-times vsetvli 4
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O2 
> scan-assembler-times vsetvli 4
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 4
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 4
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O1 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O2 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -Os 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O1 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O2 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O1 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O2 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -Os 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-65.c   -O2 
> scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-65.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-65.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O0 scan-assembler-not 
> vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O1 scan-assembler-not 
> vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2 scan-assembler-not 
> vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-not vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-not vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O3 -g 
> scan-assembler-not vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -Os scan-assembler-not 
> vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-10.c   -O3 -g 
> scan-assembler-times vsetvli 15
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-11.c   -O3 -g 
> scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-12.c   -O3 -g 
> scan-assembler-times vsetvli 9
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-13.c   -O3 -g 
> scan-assembler-times vsetvli 9
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-14.c   -O3 -g 
> scan-assembler-times vsetvli 1
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-15.c   -O3 -g 
> scan-assembler-times vsetvli 4
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-16.c   -O3 -g 
> scan-assembler-times vsetvli 15
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-18.c   -O3 -g 
> scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-19.c   -O3 -g 
> scan-assembler-times vsetvli 15
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-9.c   -O3 -g 
> scan-assembler-times vsetvli 15
> 
> [3] rv32gcv New failures:
> FAIL: gcc.target/riscv/zero-scratch-regs-2.c   -O3 -g scan-assembler-not 
> \\mvsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O1 
> scan-assembler-times vsetvli 1
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 
> scan-assembler-times vsetvli 1
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 1
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 1
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -Os 
> scan-assembler-times vsetvli 1
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O1 
> scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O2 
> scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -Os 
> scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O1 
> scan-assembler-times vsetvli 4
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O2 
> scan-assembler-times vsetvli 4
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 4
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 4
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O1 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O2 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -Os 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O1 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O2 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O1 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O2 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -Os 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-65.c   -O2 
> scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-65.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-65.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O0 scan-assembler-not 
> vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O1 scan-assembler-not 
> vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2 scan-assembler-not 
> vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-not vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-not vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O3 -g 
> scan-assembler-not vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -Os scan-assembler-not 
> vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-10.c   -O3 -g 
> scan-assembler-times vsetvli 15
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-11.c   -O3 -g 
> scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-12.c   -O3 -g 
> scan-assembler-times vsetvli 9
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-13.c   -O3 -g 
> scan-assembler-times vsetvli 9
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-14.c   -O3 -g 
> scan-assembler-times vsetvli 1
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-15.c   -O3 -g 
> scan-assembler-times vsetvli 4
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-16.c   -O3 -g 
> scan-assembler-times vsetvli 15
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-18.c   -O3 -g 
> scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-19.c   -O3 -g 
> scan-assembler-times vsetvli 15
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-9.c   -O3 -g 
> scan-assembler-times vsetvli 15
> 
> On 10/17/23 04:34, Lehua Ding wrote:
>> This patch refactors and cleanups the vsetvl pass in order to make the 
>> code
>> easier to modify and understand. This patch does several things:
>>
>> 1. Introducing a virtual CFG for vsetvl infos and Phase 1, 2 and 3 
>> only maintain
>>     and modify this virtual CFG. Phase 4 performs insertion, 
>> modification and
>>     deletion of vsetvl insns based on the virtual CFG. The Basic block 
>> in the
>>     virtual CFG is called vsetvl_block_info and the vsetvl information 
>> inside
>>     is called vsetvl_info.
>> 2. Combine Phase 1 and 2 into a single Phase 1 and unified the demand 
>> system,
>>     this Phase only fuse local vsetvl info in forward direction.
>> 3. Refactor Phase 3, change the logic for determining whether to 
>> uplift vsetvl
>>     info to a pred basic block to a more unified method that there is 
>> a vsetvl
>>     info in the vsetvl defintion reaching in compatible with it.
>> 4. Place all modification operations to the RTL in Phase 4 and Phase 5.
>>     Phase 4 is responsible for inserting, modifying and deleting vsetvl
>>     instructions based on fully optimized vsetvl infos. Phase 5 
>> removes the avl
>>     operand from the RVV instruction and removes the unused dest operand
>>     register from the vsetvl insns.
>>
>> These modifications resulted in some testcases needing to be updated. 
>> The reasons
>> for updating are summarized below:
>>
>> 1. more optimized
>>     vlmax_back_prop-25.c/vlmax_back_prop-26.c/vlmax_conflict-3.c/
>>     vlmax_conflict-12.c/vsetvl-13.c/vsetvl-23.c/
>>     avl_single-23.c/avl_single-89.c/avl_single-95.c/pr109773-1.c
>> 2. less unnecessary fusion
>>     avl_single-46.c/imm_bb_prop-1.c/pr109743-2.c/vsetvl-18.c
>> 3. local fuse direction (backward -> forward)
>>     scalar_move-1.c/
>> 4. add some bugfix testcases.
>>     pr111037-3.c/pr111037-4.c
>>     avl_single-89.c
>>
>>     PR target/111037
>>     PR target/111234
>>     PR target/111725
>>
>>
>> Lehua Ding (14):
>>    RISC-V: P1: Refactor avl_info/vl_vtype_info/vector_insn_info
>>    RISC-V: P2: Refactor and cleanup demand system
>>    RISC-V: P3: Refactor class vector_infos_manager to pre_vsetvl
>>    RISC-V: P4: move method from class pass_vsetvl to pre_vsetvl
>>    RISC-V: P5: combine phase 1 and 2 into a single pahse
>>    RISC-V: P6: Add compute reaching definition data flow
>>    RISC-V: P7: Move earliest fuse and lcm code to pre_vsetvl class
>>    RISC-V: P8: Unified insert and delete of vsetvl insn into Phase 4
>>    RISC-V: P9: Cleanup post optimize phase
>>    RISC-V: P10: Cleanup helper functions
>>    RISC-V: P11:  Refactor vector_block_info to vsetvl_block_info class
>>    RISC-V: P12: Delete riscv-vsetvl.h
>>    RISC-V: P13:  Reorganize functions used to modify RTL
>>    RISC-V: P14: Adjust and add testcases
>>
>>   gcc/config/riscv/riscv-vsetvl.cc              | 6530 +++++++----------
>>   gcc/config/riscv/riscv-vsetvl.def             |  634 +-
>>   gcc/config/riscv/riscv-vsetvl.h               |  488 --
>>   gcc/config/riscv/t-riscv                      |    2 +-
>>   .../gcc.target/riscv/rvv/base/pr111037-2.c    |    8 -
>>   .../gcc.target/riscv/rvv/base/scalar_move-1.c |    2 +-
>>   .../riscv/rvv/vsetvl/avl_single-104.c         |   35 +
>>   .../riscv/rvv/vsetvl/avl_single-105.c         |   23 +
>>   .../riscv/rvv/vsetvl/avl_single-23.c          |    7 +-
>>   .../riscv/rvv/vsetvl/avl_single-46.c          |    3 +-
>>   .../riscv/rvv/vsetvl/avl_single-89.c          |    8 +-
>>   .../riscv/rvv/vsetvl/avl_single-95.c          |    2 +-
>>   .../riscv/rvv/vsetvl/imm_bb_prop-1.c          |    7 +-
>>   .../gcc.target/riscv/rvv/vsetvl/pr109743-2.c  |    2 +-
>>   .../gcc.target/riscv/rvv/vsetvl/pr109773-1.c  |    2 +-
>>   .../gcc.target/riscv/rvv/vsetvl/pr111037-3.c  |   16 +
>>   .../pr111037-1.c => vsetvl/pr111037-4.c}      |    5 +-
>>   .../riscv/rvv/vsetvl/vlmax_back_prop-25.c     |   10 +-
>>   .../riscv/rvv/vsetvl/vlmax_back_prop-26.c     |   10 +-
>>   .../riscv/rvv/vsetvl/vlmax_conflict-12.c      |    1 -
>>   .../riscv/rvv/vsetvl/vlmax_conflict-3.c       |    2 +-
>>   .../gcc.target/riscv/rvv/vsetvl/vsetvl-13.c   |    4 +-
>>   .../gcc.target/riscv/rvv/vsetvl/vsetvl-18.c   |    4 +-
>>   .../gcc.target/riscv/rvv/vsetvl/vsetvl-23.c   |    2 +-
>>   24 files changed, 3084 insertions(+), 4723 deletions(-)
>>   delete mode 100644 gcc/config/riscv/riscv-vsetvl.h
>>   delete mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/pr111037-2.c
>>   create mode 100644 
>> gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-104.c
>>   create mode 100644 
>> gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-105.c
>>   create mode 100644 
>> gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111037-3.c
>>   rename gcc/testsuite/gcc.target/riscv/rvv/{base/pr111037-1.c => 
>> vsetvl/pr111037-4.c} (74%)
>>
>> -- 
>> 2.36.3
>>
>
  
Lehua Ding Oct. 18, 2023, 9:14 a.m. UTC | #3
Hi Patrick,

I can locally reproduce the failure of the testcase slp-7.c (the reason 
is because I missed a small part of the code while splitting the patch). 
But I can't reproduce the testcases of the assembly check locally, can 
you help me to see how the compiler options of a failed case in your 
build-gcc-dir/gcc/testsuite/gcc/gcc.log file which is look like bellow 
(Maybe you can just copy this similar paragraph below for me and I'll 
try again locally with the same compiler options, thanks a lot.):

Executing on host: 
/work/home/lding/open-source/riscv-gnu-toolchain-push/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/build-gcc-newlib-stage2/gcc/xgcc 
-B/work/home/ldi
ng/open-source/riscv-gnu-toolchain-push/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/build-gcc-newlib-stage2/gcc/ 
  /work/home/lding/open-source/riscv-gnu-toolchain-pus
h/gcc/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_convert_float2int_run-1.c 
  -march=rv64gcv_zvfh_zfh -mabi=lp64d -mcmodel=medany 
-fdiagnostics-plain-output   -ftree-vecto
rize -O3 --param riscv-autovec-lmul=m4 
--param=riscv-autovec-preference=scalable -fno-vect-cost-model      -lm 
-o ./cond_convert_float2int_run-1.exe    (timeout = 600)
spawn -ignore SIGHUP 
/work/home/lding/open-source/riscv-gnu-toolchain-push/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/build-gcc-newlib-stage2/gcc/xgcc 
-B/work/home/l
ding/open-source/riscv-gnu-toolchain-push/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/build-gcc-newlib-stage2/gcc/ 
/work/home/lding/open-source/riscv-gnu-toolchain-pu
sh/gcc/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_convert_float2int_run-1.c 
-march=rv64gcv_zvfh_zfh -mabi=lp64d -mcmodel=medany 
-fdiagnostics-plain-output -ftree-vectorize
  -O3 --param riscv-autovec-lmul=m4 
--param=riscv-autovec-preference=scalable -fno-vect-cost-model -lm -o 
./cond_convert_float2int_run-1.exe
PASS: gcc.target/riscv/rvv/autovec/cond/cond_convert_float2int_run-1.c 
(test for excess errors)
spawn riscv64-unknown-elf-run ./cond_convert_float2int_run-1.exe
bbl loader


On 2023/10/18 4:25, Patrick O'Neill wrote:
> Hi Lehua!
> 
> I ran the gcc testsuite on qemu before/after applying your patches to 
> 305034e3 rv32/64gcv [1].
> 
> Baseline
>                 ========= Summary of gcc testsuite =========
>                              | # of unexpected case / # of unique 
> unexpected case
>                              |          gcc |          g++ | gfortran |
>      rv32gcv/ ilp32d/ medlow |  208 /    78 |   29 /    17 |   71 /    24 |
>      rv64gcv/  lp64d/ medlow |  101 /    54 |   13 /     4 |   33 /    13 |
> 
> After applying patch series:
>                 ========= Summary of gcc testsuite =========
>                              | # of unexpected case / # of unique 
> unexpected case
>                              |          gcc |          g++ | gfortran |
>      rv32gcv/ ilp32d/ medlow |  256 /    96 |   29 /    17 |   69 /    23 |
>      rv64gcv/  lp64d/ medlow |  152 /    74 |   13 /     4 |   31 /    12 |
> 
> I'm seeing:
> 20 new unique gcc failures on rv64gcv [2]
> 18 new unique gcc failures on rv32gcv [3]
> 
> Thanks,
> Patrick
> 
> [1] Build commands:
> git clone https://github.com/patrick-rivos/riscv-gnu-toolchain.git
> cd riscv-gnu-toolchain
> git submodule update --init gcc
> cd gcc
> git checkout 305034e3
> cd ..
> mkdir build
> cd build
> ../configure --prefix=$(pwd) 
> --with-multilib-generator="rv64gcv-lp64d--;rv32gcv-ilp32d--"
> make report-linux -j32
> 
> Note: If you'd prefer to use upstream riscv-gnu-toolchain, I'm pretty 
> sure you can do
> mkdir build-64
> cd build-64
> ../configure --prefix=$(pwd) --with-arch=rv64gcv --with-abi=lp64d
> cd ..
> mkdir build-32
> cd build-32
> ../configure --prefix=$(pwd) --with-arch=rv32gcv --with-abi=lp32d
> This'll make 2 folders, so run make report-linux in each of them.
> 
> [2] rv64gcv New failures:
> FAIL: gcc.dg/vect/slp-7.c -flto -ffat-lto-objects execution test
> FAIL: gcc.dg/vect/slp-7.c execution test
> FAIL: gcc.target/riscv/zero-scratch-regs-2.c   -O3 -g scan-assembler-not 
> \\mvsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O1 
> scan-assembler-times vsetvli 1
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 
> scan-assembler-times vsetvli 1
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 1
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 1
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -Os 
> scan-assembler-times vsetvli 1
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O1 
> scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O2 
> scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -Os 
> scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O1 
> scan-assembler-times vsetvli 4
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O2 
> scan-assembler-times vsetvli 4
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 4
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 4
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O1 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O2 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -Os 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O1 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O2 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O1 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O2 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -Os 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-65.c   -O2 
> scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-65.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-65.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O0 scan-assembler-not 
> vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O1 scan-assembler-not 
> vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2 scan-assembler-not 
> vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-not vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-not vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O3 -g 
> scan-assembler-not vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -Os scan-assembler-not 
> vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-10.c   -O3 -g 
> scan-assembler-times vsetvli 15
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-11.c   -O3 -g 
> scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-12.c   -O3 -g 
> scan-assembler-times vsetvli 9
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-13.c   -O3 -g 
> scan-assembler-times vsetvli 9
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-14.c   -O3 -g 
> scan-assembler-times vsetvli 1
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-15.c   -O3 -g 
> scan-assembler-times vsetvli 4
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-16.c   -O3 -g 
> scan-assembler-times vsetvli 15
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-18.c   -O3 -g 
> scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-19.c   -O3 -g 
> scan-assembler-times vsetvli 15
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-9.c   -O3 -g 
> scan-assembler-times vsetvli 15
> 
> [3] rv32gcv New failures:
> FAIL: gcc.target/riscv/zero-scratch-regs-2.c   -O3 -g scan-assembler-not 
> \\mvsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O1 
> scan-assembler-times vsetvli 1
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 
> scan-assembler-times vsetvli 1
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 1
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 1
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -Os 
> scan-assembler-times vsetvli 1
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O1 
> scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O2 
> scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -Os 
> scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O1 
> scan-assembler-times vsetvli 4
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O2 
> scan-assembler-times vsetvli 4
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 4
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 4
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O1 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O2 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -Os 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O1 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O2 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O1 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O2 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -Os 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-65.c   -O2 
> scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-65.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-65.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O0 scan-assembler-not 
> vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O1 scan-assembler-not 
> vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2 scan-assembler-not 
> vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-not vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-not vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O3 -g 
> scan-assembler-not vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -Os scan-assembler-not 
> vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-10.c   -O3 -g 
> scan-assembler-times vsetvli 15
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-11.c   -O3 -g 
> scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-12.c   -O3 -g 
> scan-assembler-times vsetvli 9
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-13.c   -O3 -g 
> scan-assembler-times vsetvli 9
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-14.c   -O3 -g 
> scan-assembler-times vsetvli 1
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-15.c   -O3 -g 
> scan-assembler-times vsetvli 4
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-16.c   -O3 -g 
> scan-assembler-times vsetvli 15
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-18.c   -O3 -g 
> scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-19.c   -O3 -g 
> scan-assembler-times vsetvli 15
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-9.c   -O3 -g 
> scan-assembler-times vsetvli 15
> 
> On 10/17/23 04:34, Lehua Ding wrote:
>> This patch refactors and cleanups the vsetvl pass in order to make the 
>> code
>> easier to modify and understand. This patch does several things:
>>
>> 1. Introducing a virtual CFG for vsetvl infos and Phase 1, 2 and 3 
>> only maintain
>>     and modify this virtual CFG. Phase 4 performs insertion, 
>> modification and
>>     deletion of vsetvl insns based on the virtual CFG. The Basic block 
>> in the
>>     virtual CFG is called vsetvl_block_info and the vsetvl information 
>> inside
>>     is called vsetvl_info.
>> 2. Combine Phase 1 and 2 into a single Phase 1 and unified the demand 
>> system,
>>     this Phase only fuse local vsetvl info in forward direction.
>> 3. Refactor Phase 3, change the logic for determining whether to 
>> uplift vsetvl
>>     info to a pred basic block to a more unified method that there is 
>> a vsetvl
>>     info in the vsetvl defintion reaching in compatible with it.
>> 4. Place all modification operations to the RTL in Phase 4 and Phase 5.
>>     Phase 4 is responsible for inserting, modifying and deleting vsetvl
>>     instructions based on fully optimized vsetvl infos. Phase 5 
>> removes the avl
>>     operand from the RVV instruction and removes the unused dest operand
>>     register from the vsetvl insns.
>>
>> These modifications resulted in some testcases needing to be updated. 
>> The reasons
>> for updating are summarized below:
>>
>> 1. more optimized
>>     vlmax_back_prop-25.c/vlmax_back_prop-26.c/vlmax_conflict-3.c/
>>     vlmax_conflict-12.c/vsetvl-13.c/vsetvl-23.c/
>>     avl_single-23.c/avl_single-89.c/avl_single-95.c/pr109773-1.c
>> 2. less unnecessary fusion
>>     avl_single-46.c/imm_bb_prop-1.c/pr109743-2.c/vsetvl-18.c
>> 3. local fuse direction (backward -> forward)
>>     scalar_move-1.c/
>> 4. add some bugfix testcases.
>>     pr111037-3.c/pr111037-4.c
>>     avl_single-89.c
>>
>>     PR target/111037
>>     PR target/111234
>>     PR target/111725
>>
>>
>> Lehua Ding (14):
>>    RISC-V: P1: Refactor avl_info/vl_vtype_info/vector_insn_info
>>    RISC-V: P2: Refactor and cleanup demand system
>>    RISC-V: P3: Refactor class vector_infos_manager to pre_vsetvl
>>    RISC-V: P4: move method from class pass_vsetvl to pre_vsetvl
>>    RISC-V: P5: combine phase 1 and 2 into a single pahse
>>    RISC-V: P6: Add compute reaching definition data flow
>>    RISC-V: P7: Move earliest fuse and lcm code to pre_vsetvl class
>>    RISC-V: P8: Unified insert and delete of vsetvl insn into Phase 4
>>    RISC-V: P9: Cleanup post optimize phase
>>    RISC-V: P10: Cleanup helper functions
>>    RISC-V: P11:  Refactor vector_block_info to vsetvl_block_info class
>>    RISC-V: P12: Delete riscv-vsetvl.h
>>    RISC-V: P13:  Reorganize functions used to modify RTL
>>    RISC-V: P14: Adjust and add testcases
>>
>>   gcc/config/riscv/riscv-vsetvl.cc              | 6530 +++++++----------
>>   gcc/config/riscv/riscv-vsetvl.def             |  634 +-
>>   gcc/config/riscv/riscv-vsetvl.h               |  488 --
>>   gcc/config/riscv/t-riscv                      |    2 +-
>>   .../gcc.target/riscv/rvv/base/pr111037-2.c    |    8 -
>>   .../gcc.target/riscv/rvv/base/scalar_move-1.c |    2 +-
>>   .../riscv/rvv/vsetvl/avl_single-104.c         |   35 +
>>   .../riscv/rvv/vsetvl/avl_single-105.c         |   23 +
>>   .../riscv/rvv/vsetvl/avl_single-23.c          |    7 +-
>>   .../riscv/rvv/vsetvl/avl_single-46.c          |    3 +-
>>   .../riscv/rvv/vsetvl/avl_single-89.c          |    8 +-
>>   .../riscv/rvv/vsetvl/avl_single-95.c          |    2 +-
>>   .../riscv/rvv/vsetvl/imm_bb_prop-1.c          |    7 +-
>>   .../gcc.target/riscv/rvv/vsetvl/pr109743-2.c  |    2 +-
>>   .../gcc.target/riscv/rvv/vsetvl/pr109773-1.c  |    2 +-
>>   .../gcc.target/riscv/rvv/vsetvl/pr111037-3.c  |   16 +
>>   .../pr111037-1.c => vsetvl/pr111037-4.c}      |    5 +-
>>   .../riscv/rvv/vsetvl/vlmax_back_prop-25.c     |   10 +-
>>   .../riscv/rvv/vsetvl/vlmax_back_prop-26.c     |   10 +-
>>   .../riscv/rvv/vsetvl/vlmax_conflict-12.c      |    1 -
>>   .../riscv/rvv/vsetvl/vlmax_conflict-3.c       |    2 +-
>>   .../gcc.target/riscv/rvv/vsetvl/vsetvl-13.c   |    4 +-
>>   .../gcc.target/riscv/rvv/vsetvl/vsetvl-18.c   |    4 +-
>>   .../gcc.target/riscv/rvv/vsetvl/vsetvl-23.c   |    2 +-
>>   24 files changed, 3084 insertions(+), 4723 deletions(-)
>>   delete mode 100644 gcc/config/riscv/riscv-vsetvl.h
>>   delete mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/pr111037-2.c
>>   create mode 100644 
>> gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-104.c
>>   create mode 100644 
>> gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-105.c
>>   create mode 100644 
>> gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111037-3.c
>>   rename gcc/testsuite/gcc.target/riscv/rvv/{base/pr111037-1.c => 
>> vsetvl/pr111037-4.c} (74%)
>>
>> -- 
>> 2.36.3
>>
>
  
Patrick O'Neill Oct. 18, 2023, 5:17 p.m. UTC | #4
Hi Luhua,

Here's the excerpts from the debug log. I think the full log files are 
too large to send over email.

rv32_gcv avl_single-32.c:

Executing on host: /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/  /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-34.c  -march=rv32gcv -mabi=ilp32d -mcmodel=medlow   -fdiagnostics-plain-output  -O0 -march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2 -fno-tree-vectorize -ffat-lto-objects -fno-ident -S   -o avl_single-34.s    (timeout = 600)
spawn -ignore SIGHUP /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/ /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-34.c -march=rv32gcv -mabi=ilp32d -mcmodel=medlow -fdiagnostics-plain-output -O0 -march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2 -fno-tree-vectorize -ffat-lto-objects -fno-ident -S -o avl_single-34.s
PASS: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O0  (test for excess errors)
Executing on host: /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/  /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-34.c  -march=rv32gcv -mabi=ilp32d -mcmodel=medlow   -fdiagnostics-plain-output  -O1 -march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2 -fno-tree-vectorize -ffat-lto-objects -fno-ident -S   -o avl_single-34.s    (timeout = 600)
spawn -ignore SIGHUP /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/ /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-34.c -march=rv32gcv -mabi=ilp32d -mcmodel=medlow -fdiagnostics-plain-output -O1 -march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2 -fno-tree-vectorize -ffat-lto-objects -fno-ident -S -o avl_single-34.s
PASS: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O1  (test for excess errors)
PASS: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O1   scan-assembler-times vsetvli\\s+zero,\\s*[a-x0-9]+,\\s*e8,\\s*mf8,\\s*tu,\\s*m[au] 1
gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O1  : vsetvli found 2 times
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O1   scan-assembler-times vsetvli 1
Executing on host: /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/  /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-34.c  -march=rv32gcv -mabi=ilp32d -mcmodel=medlow   -fdiagnostics-plain-output  -O2 -march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2 -fno-tree-vectorize -ffat-lto-objects -fno-ident -S   -o avl_single-34.s    (timeout = 600)
spawn -ignore SIGHUP /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/ /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-34.c -march=rv32gcv -mabi=ilp32d -mcmodel=medlow -fdiagnostics-plain-output -O2 -march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2 -fno-tree-vectorize -ffat-lto-objects -fno-ident -S -o avl_single-34.s
PASS: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2  (test for excess errors)
PASS: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2   scan-assembler-times vsetvli\\s+zero,\\s*[a-x0-9]+,\\s*e8,\\s*mf8,\\s*tu,\\s*m[au] 1
gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2  : vsetvli found 2 times
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2   scan-assembler-times vsetvli 1
Executing on host: /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/  /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-34.c  -march=rv32gcv -mabi=ilp32d -mcmodel=medlow   -fdiagnostics-plain-output  -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions -march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2 -fno-tree-vectorize -ffat-lto-objects -fno-ident -S   -o avl_single-34.s    (timeout = 600)
spawn -ignore SIGHUP /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/ /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-34.c -march=rv32gcv -mabi=ilp32d -mcmodel=medlow -fdiagnostics-plain-output -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions -march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2 -fno-tree-vectorize -ffat-lto-objects -fno-ident -S -o avl_single-34.s
PASS: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions  (test for excess errors)
Executing on host: /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/  /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-34.c  -march=rv32gcv -mabi=ilp32d -mcmodel=medlow   -fdiagnostics-plain-output  -O3 -g -march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2 -fno-tree-vectorize -ffat-lto-objects -fno-ident -S   -o avl_single-34.s    (timeout = 600)
spawn -ignore SIGHUP /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/ /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-34.c -march=rv32gcv -mabi=ilp32d -mcmodel=medlow -fdiagnostics-plain-output -O3 -g -march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2 -fno-tree-vectorize -ffat-lto-objects -fno-ident -S -o avl_single-34.s
PASS: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O3 -g  (test for excess errors)
Executing on host: /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/  /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-34.c  -march=rv32gcv -mabi=ilp32d -mcmodel=medlow   -fdiagnostics-plain-output  -Os -march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2 -fno-tree-vectorize -ffat-lto-objects -fno-ident -S   -o avl_single-34.s    (timeout = 600)
spawn -ignore SIGHUP /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/ /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-34.c -march=rv32gcv -mabi=ilp32d -mcmodel=medlow -fdiagnostics-plain-output -Os -march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2 -fno-tree-vectorize -ffat-lto-objects -fno-ident -S -o avl_single-34.s
PASS: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -Os  (test for excess errors)
PASS: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -Os   scan-assembler-times vsetvli\\s+zero,\\s*[a-x0-9]+,\\s*e8,\\s*mf8,\\s*tu,\\s*m[au] 1
gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -Os  : vsetvli found 2 times
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -Os   scan-assembler-times vsetvli 1
Executing on host: /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/  /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-34.c  -march=rv32gcv -mabi=ilp32d -mcmodel=medlow   -fdiagnostics-plain-output  -O2 -flto -fno-use-linker-plugin -flto-partition=none -march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2 -fno-tree-vectorize -ffat-lto-objects -fno-ident -S   -o avl_single-34.s    (timeout = 600)
spawn -ignore SIGHUP /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/ /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-34.c -march=rv32gcv -mabi=ilp32d -mcmodel=medlow -fdiagnostics-plain-output -O2 -flto -fno-use-linker-plugin -flto-partition=none -march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2 -fno-tree-vectorize -ffat-lto-objects -fno-ident -S -o avl_single-34.s
PASS: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 -flto -fno-use-linker-plugin -flto-partition=none  (test for excess errors)
PASS: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 -flto -fno-use-linker-plugin -flto-partition=none   scan-assembler-times vsetvli\\s+zero,\\s*[a-x0-9]+,\\s*e8,\\s*mf8,\\s*tu,\\s*m[au] 1
gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 -flto -fno-use-linker-plugin -flto-partition=none  : vsetvli found 2 times
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 -flto -fno-use-linker-plugin -flto-partition=none   scan-assembler-times vsetvli 1
Executing on host: /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/  /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-34.c  -march=rv32gcv -mabi=ilp32d -mcmodel=medlow   -fdiagnostics-plain-output  -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects -march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2 -fno-tree-vectorize -ffat-lto-objects -fno-ident -S   -o avl_single-34.s    (timeout = 600)
spawn -ignore SIGHUP /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/ /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-34.c -march=rv32gcv -mabi=ilp32d -mcmodel=medlow -fdiagnostics-plain-output -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects -march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2 -fno-tree-vectorize -ffat-lto-objects -fno-ident -S -o avl_single-34.s
PASS: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  (test for excess errors)
PASS: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli\\s+zero,\\s*[a-x0-9]+,\\s*e8,\\s*mf8,\\s*tu,\\s*m[au] 1
gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  : vsetvli found 2 times
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 1

rv32_gcv pr111037-2.c:

Executing on host: /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/  /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111037-2.c  -march=rv32gcv -mabi=ilp32d -mcmodel=medlow   -fdiagnostics-plain-output  -O0 -march=rv32gc_zve64d_zvfh -mabi=ilp32d -O3 -ffat-lto-objects -fno-ident -S   -o pr111037-2.s    (timeout = 600)
spawn -ignore SIGHUP /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/ /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111037-2.c -march=rv32gcv -mabi=ilp32d -mcmodel=medlow -fdiagnostics-plain-output -O0 -march=rv32gc_zve64d_zvfh -mabi=ilp32d -O3 -ffat-lto-objects -fno-ident -S -o pr111037-2.s
PASS: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O0  (test for excess errors)
PASS: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O0   scan-assembler-times vsetivli\\s+zero,\\s*1,\\s*e64,\\s*m1,\\s*t[au],\\s*m[au] 1
FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O0   scan-assembler-not vsetvli
PASS: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O0   scan-assembler-times vsetivli 1
Executing on host: /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/  /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111037-2.c  -march=rv32gcv -mabi=ilp32d -mcmodel=medlow   -fdiagnostics-plain-output  -O1 -march=rv32gc_zve64d_zvfh -mabi=ilp32d -O3 -ffat-lto-objects -fno-ident -S   -o pr111037-2.s    (timeout = 600)
spawn -ignore SIGHUP /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/ /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111037-2.c -march=rv32gcv -mabi=ilp32d -mcmodel=medlow -fdiagnostics-plain-output -O1 -march=rv32gc_zve64d_zvfh -mabi=ilp32d -O3 -ffat-lto-objects -fno-ident -S -o pr111037-2.s
PASS: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O1  (test for excess errors)
PASS: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O1   scan-assembler-times vsetivli\\s+zero,\\s*1,\\s*e64,\\s*m1,\\s*t[au],\\s*m[au] 1
FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O1   scan-assembler-not vsetvli
PASS: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O1   scan-assembler-times vsetivli 1
Executing on host: /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/  /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111037-2.c  -march=rv32gcv -mabi=ilp32d -mcmodel=medlow   -fdiagnostics-plain-output  -O2 -march=rv32gc_zve64d_zvfh -mabi=ilp32d -O3 -ffat-lto-objects -fno-ident -S   -o pr111037-2.s    (timeout = 600)
spawn -ignore SIGHUP /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/ /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111037-2.c -march=rv32gcv -mabi=ilp32d -mcmodel=medlow -fdiagnostics-plain-output -O2 -march=rv32gc_zve64d_zvfh -mabi=ilp32d -O3 -ffat-lto-objects -fno-ident -S -o pr111037-2.s
PASS: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2  (test for excess errors)
PASS: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2   scan-assembler-times vsetivli\\s+zero,\\s*1,\\s*e64,\\s*m1,\\s*t[au],\\s*m[au] 1
FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2   scan-assembler-not vsetvli
PASS: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2   scan-assembler-times vsetivli 1
Executing on host: /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/  /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111037-2.c  -march=rv32gcv -mabi=ilp32d -mcmodel=medlow   -fdiagnostics-plain-output  -O3 -g -march=rv32gc_zve64d_zvfh -mabi=ilp32d -O3 -ffat-lto-objects -fno-ident -S   -o pr111037-2.s    (timeout = 600)
spawn -ignore SIGHUP /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/ /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111037-2.c -march=rv32gcv -mabi=ilp32d -mcmodel=medlow -fdiagnostics-plain-output -O3 -g -march=rv32gc_zve64d_zvfh -mabi=ilp32d -O3 -ffat-lto-objects -fno-ident -S -o pr111037-2.s
PASS: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O3 -g  (test for excess errors)
PASS: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O3 -g   scan-assembler-times vsetivli\\s+zero,\\s*1,\\s*e64,\\s*m1,\\s*t[au],\\s*m[au] 1
FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O3 -g   scan-assembler-not vsetvli
PASS: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O3 -g   scan-assembler-times vsetivli 1
Executing on host: /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/  /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111037-2.c  -march=rv32gcv -mabi=ilp32d -mcmodel=medlow   -fdiagnostics-plain-output  -Os -march=rv32gc_zve64d_zvfh -mabi=ilp32d -O3 -ffat-lto-objects -fno-ident -S   -o pr111037-2.s    (timeout = 600)
spawn -ignore SIGHUP /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/ /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111037-2.c -march=rv32gcv -mabi=ilp32d -mcmodel=medlow -fdiagnostics-plain-output -Os -march=rv32gc_zve64d_zvfh -mabi=ilp32d -O3 -ffat-lto-objects -fno-ident -S -o pr111037-2.s
PASS: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -Os  (test for excess errors)
PASS: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -Os   scan-assembler-times vsetivli\\s+zero,\\s*1,\\s*e64,\\s*m1,\\s*t[au],\\s*m[au] 1
FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -Os   scan-assembler-not vsetvli
PASS: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -Os   scan-assembler-times vsetivli 1
Executing on host: /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/  /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111037-2.c  -march=rv32gcv -mabi=ilp32d -mcmodel=medlow   -fdiagnostics-plain-output  -O2 -flto -fno-use-linker-plugin -flto-partition=none -march=rv32gc_zve64d_zvfh -mabi=ilp32d -O3 -ffat-lto-objects -fno-ident -S   -o pr111037-2.s    (timeout = 600)
spawn -ignore SIGHUP /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/ /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111037-2.c -march=rv32gcv -mabi=ilp32d -mcmodel=medlow -fdiagnostics-plain-output -O2 -flto -fno-use-linker-plugin -flto-partition=none -march=rv32gc_zve64d_zvfh -mabi=ilp32d -O3 -ffat-lto-objects -fno-ident -S -o pr111037-2.s
PASS: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2 -flto -fno-use-linker-plugin -flto-partition=none  (test for excess errors)
PASS: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2 -flto -fno-use-linker-plugin -flto-partition=none   scan-assembler-times vsetivli\\s+zero,\\s*1,\\s*e64,\\s*m1,\\s*t[au],\\s*m[au] 1
FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2 -flto -fno-use-linker-plugin -flto-partition=none   scan-assembler-not vsetvli
PASS: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2 -flto -fno-use-linker-plugin -flto-partition=none   scan-assembler-times vsetivli 1
Executing on host: /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/  /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111037-2.c  -march=rv32gcv -mabi=ilp32d -mcmodel=medlow   -fdiagnostics-plain-output  -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects -march=rv32gc_zve64d_zvfh -mabi=ilp32d -O3 -ffat-lto-objects -fno-ident -S   -o pr111037-2.s    (timeout = 600)
spawn -ignore SIGHUP /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/ /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111037-2.c -march=rv32gcv -mabi=ilp32d -mcmodel=medlow -fdiagnostics-plain-output -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects -march=rv32gc_zve64d_zvfh -mabi=ilp32d -O3 -ffat-lto-objects -fno-ident -S -o pr111037-2.s
PASS: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  (test for excess errors)
PASS: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetivli\\s+zero,\\s*1,\\s*e64,\\s*m1,\\s*t[au],\\s*m[au] 1
FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-not vsetvli
PASS: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetivli 1

rv64_gcv avl_single-34.c:

Executing on host: /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/  /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-34.c  -march=rv64gcv -mabi=lp64d -mcmodel=medlow   -fdiagnostics-plain-output  -O0 -march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2 -fno-tree-vectorize -ffat-lto-objects -fno-ident -S   -o avl_single-34.s    (timeout = 600)
spawn -ignore SIGHUP /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/ /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-34.c -march=rv64gcv -mabi=lp64d -mcmodel=medlow -fdiagnostics-plain-output -O0 -march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2 -fno-tree-vectorize -ffat-lto-objects -fno-ident -S -o avl_single-34.s
PASS: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O0  (test for excess errors)
Executing on host: /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/  /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-34.c  -march=rv64gcv -mabi=lp64d -mcmodel=medlow   -fdiagnostics-plain-output  -O1 -march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2 -fno-tree-vectorize -ffat-lto-objects -fno-ident -S   -o avl_single-34.s    (timeout = 600)
spawn -ignore SIGHUP /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/ /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-34.c -march=rv64gcv -mabi=lp64d -mcmodel=medlow -fdiagnostics-plain-output -O1 -march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2 -fno-tree-vectorize -ffat-lto-objects -fno-ident -S -o avl_single-34.s
PASS: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O1  (test for excess errors)
PASS: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O1   scan-assembler-times vsetvli\\s+zero,\\s*[a-x0-9]+,\\s*e8,\\s*mf8,\\s*tu,\\s*m[au] 1
gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O1  : vsetvli found 2 times
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O1   scan-assembler-times vsetvli 1
Executing on host: /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/  /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-34.c  -march=rv64gcv -mabi=lp64d -mcmodel=medlow   -fdiagnostics-plain-output  -O2 -march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2 -fno-tree-vectorize -ffat-lto-objects -fno-ident -S   -o avl_single-34.s    (timeout = 600)
spawn -ignore SIGHUP /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/ /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-34.c -march=rv64gcv -mabi=lp64d -mcmodel=medlow -fdiagnostics-plain-output -O2 -march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2 -fno-tree-vectorize -ffat-lto-objects -fno-ident -S -o avl_single-34.s
PASS: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2  (test for excess errors)
PASS: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2   scan-assembler-times vsetvli\\s+zero,\\s*[a-x0-9]+,\\s*e8,\\s*mf8,\\s*tu,\\s*m[au] 1
gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2  : vsetvli found 2 times
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2   scan-assembler-times vsetvli 1
Executing on host: /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/  /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-34.c  -march=rv64gcv -mabi=lp64d -mcmodel=medlow   -fdiagnostics-plain-output  -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions -march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2 -fno-tree-vectorize -ffat-lto-objects -fno-ident -S   -o avl_single-34.s    (timeout = 600)
spawn -ignore SIGHUP /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/ /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-34.c -march=rv64gcv -mabi=lp64d -mcmodel=medlow -fdiagnostics-plain-output -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions -march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2 -fno-tree-vectorize -ffat-lto-objects -fno-ident -S -o avl_single-34.s
PASS: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions  (test for excess errors)
Executing on host: /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/  /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-34.c  -march=rv64gcv -mabi=lp64d -mcmodel=medlow   -fdiagnostics-plain-output  -O3 -g -march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2 -fno-tree-vectorize -ffat-lto-objects -fno-ident -S   -o avl_single-34.s    (timeout = 600)
spawn -ignore SIGHUP /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/ /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-34.c -march=rv64gcv -mabi=lp64d -mcmodel=medlow -fdiagnostics-plain-output -O3 -g -march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2 -fno-tree-vectorize -ffat-lto-objects -fno-ident -S -o avl_single-34.s
PASS: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O3 -g  (test for excess errors)
Executing on host: /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/  /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-34.c  -march=rv64gcv -mabi=lp64d -mcmodel=medlow   -fdiagnostics-plain-output  -Os -march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2 -fno-tree-vectorize -ffat-lto-objects -fno-ident -S   -o avl_single-34.s    (timeout = 600)
spawn -ignore SIGHUP /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/ /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-34.c -march=rv64gcv -mabi=lp64d -mcmodel=medlow -fdiagnostics-plain-output -Os -march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2 -fno-tree-vectorize -ffat-lto-objects -fno-ident -S -o avl_single-34.s
PASS: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -Os  (test for excess errors)
PASS: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -Os   scan-assembler-times vsetvli\\s+zero,\\s*[a-x0-9]+,\\s*e8,\\s*mf8,\\s*tu,\\s*m[au] 1
gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -Os  : vsetvli found 2 times
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -Os   scan-assembler-times vsetvli 1
Executing on host: /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/  /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-34.c  -march=rv64gcv -mabi=lp64d -mcmodel=medlow   -fdiagnostics-plain-output  -O2 -flto -fno-use-linker-plugin -flto-partition=none -march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2 -fno-tree-vectorize -ffat-lto-objects -fno-ident -S   -o avl_single-34.s    (timeout = 600)
spawn -ignore SIGHUP /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/ /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-34.c -march=rv64gcv -mabi=lp64d -mcmodel=medlow -fdiagnostics-plain-output -O2 -flto -fno-use-linker-plugin -flto-partition=none -march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2 -fno-tree-vectorize -ffat-lto-objects -fno-ident -S -o avl_single-34.s
PASS: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 -flto -fno-use-linker-plugin -flto-partition=none  (test for excess errors)
PASS: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 -flto -fno-use-linker-plugin -flto-partition=none   scan-assembler-times vsetvli\\s+zero,\\s*[a-x0-9]+,\\s*e8,\\s*mf8,\\s*tu,\\s*m[au] 1
gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 -flto -fno-use-linker-plugin -flto-partition=none  : vsetvli found 2 times
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 -flto -fno-use-linker-plugin -flto-partition=none   scan-assembler-times vsetvli 1
Executing on host: /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/  /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-34.c  -march=rv64gcv -mabi=lp64d -mcmodel=medlow   -fdiagnostics-plain-output  -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects -march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2 -fno-tree-vectorize -ffat-lto-objects -fno-ident -S   -o avl_single-34.s    (timeout = 600)
spawn -ignore SIGHUP /scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/xgcc -B/scratch/tc-testing/tc-oct-17-vsetvli-refactor/build/build-gcc-linux-stage2/gcc/ /scratch/tc-testing/tc-oct-17-vsetvli-refactor/gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-34.c -march=rv64gcv -mabi=lp64d -mcmodel=medlow -fdiagnostics-plain-output -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects -march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2 -fno-tree-vectorize -ffat-lto-objects -fno-ident -S -o avl_single-34.s
PASS: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  (test for excess errors)
PASS: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli\\s+zero,\\s*[a-x0-9]+,\\s*e8,\\s*mf8,\\s*tu,\\s*m[au] 1
gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  : vsetvli found 2 times
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 1

Please let me know if I can help in any other ways.

Thanks,
Patrick

On 10/18/23 02:14, Lehua Ding wrote:
> Hi Patrick,
>
> I can locally reproduce the failure of the testcase slp-7.c (the 
> reason is because I missed a small part of the code while splitting 
> the patch). But I can't reproduce the testcases of the assembly check 
> locally, can you help me to see how the compiler options of a failed 
> case in your build-gcc-dir/gcc/testsuite/gcc/gcc.log file which is 
> look like bellow (Maybe you can just copy this similar paragraph below 
> for me and I'll try again locally with the same compiler options, 
> thanks a lot.):
>
> Executing on host: 
> /work/home/lding/open-source/riscv-gnu-toolchain-push/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/build-gcc-newlib-stage2/gcc/xgcc 
> -B/work/home/ldi
> ng/open-source/riscv-gnu-toolchain-push/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/build-gcc-newlib-stage2/gcc/ 
>  /work/home/lding/open-source/riscv-gnu-toolchain-pus
> h/gcc/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_convert_float2int_run-1.c 
>  -march=rv64gcv_zvfh_zfh -mabi=lp64d -mcmodel=medany 
> -fdiagnostics-plain-output   -ftree-vecto
> rize -O3 --param riscv-autovec-lmul=m4 
> --param=riscv-autovec-preference=scalable -fno-vect-cost-model      
> -lm -o ./cond_convert_float2int_run-1.exe    (timeout = 600)
> spawn -ignore SIGHUP 
> /work/home/lding/open-source/riscv-gnu-toolchain-push/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/build-gcc-newlib-stage2/gcc/xgcc 
> -B/work/home/l
> ding/open-source/riscv-gnu-toolchain-push/build/dev-rv64gcv_zvfh_zfh-lp64d-medany-newlib-spike-debug/build-gcc-newlib-stage2/gcc/ 
> /work/home/lding/open-source/riscv-gnu-toolchain-pu
> sh/gcc/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_convert_float2int_run-1.c 
> -march=rv64gcv_zvfh_zfh -mabi=lp64d -mcmodel=medany 
> -fdiagnostics-plain-output -ftree-vectorize
>  -O3 --param riscv-autovec-lmul=m4 
> --param=riscv-autovec-preference=scalable -fno-vect-cost-model -lm -o 
> ./cond_convert_float2int_run-1.exe
> PASS: gcc.target/riscv/rvv/autovec/cond/cond_convert_float2int_run-1.c 
> (test for excess errors)
> spawn riscv64-unknown-elf-run ./cond_convert_float2int_run-1.exe
> bbl loader
>
>
> On 2023/10/18 4:25, Patrick O'Neill wrote:
>> Hi Lehua!
>>
>> I ran the gcc testsuite on qemu before/after applying your patches to 
>> 305034e3 rv32/64gcv [1].
>>
>> Baseline
>>                 ========= Summary of gcc testsuite =========
>>                              | # of unexpected case / # of unique 
>> unexpected case
>>                              |          gcc |          g++ | gfortran |
>>      rv32gcv/ ilp32d/ medlow |  208 /    78 |   29 /    17 | 71 /    
>> 24 |
>>      rv64gcv/  lp64d/ medlow |  101 /    54 |   13 /     4 | 33 /    
>> 13 |
>>
>> After applying patch series:
>>                 ========= Summary of gcc testsuite =========
>>                              | # of unexpected case / # of unique 
>> unexpected case
>>                              |          gcc |          g++ | gfortran |
>>      rv32gcv/ ilp32d/ medlow |  256 /    96 |   29 /    17 | 69 /    
>> 23 |
>>      rv64gcv/  lp64d/ medlow |  152 /    74 |   13 /     4 | 31 /    
>> 12 |
>>
>> I'm seeing:
>> 20 new unique gcc failures on rv64gcv [2]
>> 18 new unique gcc failures on rv32gcv [3]
>>
>> Thanks,
>> Patrick
>>
>> [1] Build commands:
>> git clone https://github.com/patrick-rivos/riscv-gnu-toolchain.git
>> cd riscv-gnu-toolchain
>> git submodule update --init gcc
>> cd gcc
>> git checkout 305034e3
>> cd ..
>> mkdir build
>> cd build
>> ../configure --prefix=$(pwd) 
>> --with-multilib-generator="rv64gcv-lp64d--;rv32gcv-ilp32d--"
>> make report-linux -j32
>>
>> Note: If you'd prefer to use upstream riscv-gnu-toolchain, I'm pretty 
>> sure you can do
>> mkdir build-64
>> cd build-64
>> ../configure --prefix=$(pwd) --with-arch=rv64gcv --with-abi=lp64d
>> cd ..
>> mkdir build-32
>> cd build-32
>> ../configure --prefix=$(pwd) --with-arch=rv32gcv --with-abi=lp32d
>> This'll make 2 folders, so run make report-linux in each of them.
>>
>> [2] rv64gcv New failures:
>> FAIL: gcc.dg/vect/slp-7.c -flto -ffat-lto-objects execution test
>> FAIL: gcc.dg/vect/slp-7.c execution test
>> FAIL: gcc.target/riscv/zero-scratch-regs-2.c   -O3 -g 
>> scan-assembler-not \\mvsetvli
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O1 
>> scan-assembler-times vsetvli 1
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 
>> scan-assembler-times vsetvli 1
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 -flto 
>> -fno-use-linker-plugin -flto-partition=none scan-assembler-times 
>> vsetvli 1
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 -flto 
>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times 
>> vsetvli 1
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -Os 
>> scan-assembler-times vsetvli 1
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O1 
>> scan-assembler-times vsetvli 3
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O2 
>> scan-assembler-times vsetvli 3
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O2 -flto 
>> -fno-use-linker-plugin -flto-partition=none scan-assembler-times 
>> vsetvli 3
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O2 -flto 
>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times 
>> vsetvli 3
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -Os 
>> scan-assembler-times vsetvli 3
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O1 
>> scan-assembler-times vsetvli 4
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O2 
>> scan-assembler-times vsetvli 4
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O2 -flto 
>> -fno-use-linker-plugin -flto-partition=none scan-assembler-times 
>> vsetvli 4
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O2 -flto 
>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times 
>> vsetvli 4
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O1 
>> scan-assembler-times vsetvli 2
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O2 
>> scan-assembler-times vsetvli 2
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O2 -flto 
>> -fno-use-linker-plugin -flto-partition=none scan-assembler-times 
>> vsetvli 2
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O2 -flto 
>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times 
>> vsetvli 2
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -Os 
>> scan-assembler-times vsetvli 2
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O1 
>> scan-assembler-times vsetvli 2
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O2 
>> scan-assembler-times vsetvli 2
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O2 -flto 
>> -fno-use-linker-plugin -flto-partition=none scan-assembler-times 
>> vsetvli 2
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O2 -flto 
>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times 
>> vsetvli 2
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O1 
>> scan-assembler-times vsetvli 2
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O2 
>> scan-assembler-times vsetvli 2
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O2 -flto 
>> -fno-use-linker-plugin -flto-partition=none scan-assembler-times 
>> vsetvli 2
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O2 -flto 
>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times 
>> vsetvli 2
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -Os 
>> scan-assembler-times vsetvli 2
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-65.c   -O2 
>> scan-assembler-times vsetvli 3
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-65.c   -O2 -flto 
>> -fno-use-linker-plugin -flto-partition=none scan-assembler-times 
>> vsetvli 3
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-65.c   -O2 -flto 
>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times 
>> vsetvli 3
>> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O0 
>> scan-assembler-not vsetvli
>> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O1 
>> scan-assembler-not vsetvli
>> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2 
>> scan-assembler-not vsetvli
>> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2 -flto 
>> -fno-use-linker-plugin -flto-partition=none   scan-assembler-not vsetvli
>> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2 -flto 
>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-not vsetvli
>> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O3 -g 
>> scan-assembler-not vsetvli
>> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -Os 
>> scan-assembler-not vsetvli
>> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-10.c   -O3 -g 
>> scan-assembler-times vsetvli 15
>> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-11.c   -O3 -g 
>> scan-assembler-times vsetvli 3
>> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-12.c   -O3 -g 
>> scan-assembler-times vsetvli 9
>> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-13.c   -O3 -g 
>> scan-assembler-times vsetvli 9
>> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-14.c   -O3 -g 
>> scan-assembler-times vsetvli 1
>> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-15.c   -O3 -g 
>> scan-assembler-times vsetvli 4
>> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-16.c   -O3 -g 
>> scan-assembler-times vsetvli 15
>> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-18.c   -O3 -g 
>> scan-assembler-times vsetvli 3
>> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-19.c   -O3 -g 
>> scan-assembler-times vsetvli 15
>> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-9.c   -O3 -g 
>> scan-assembler-times vsetvli 15
>>
>> [3] rv32gcv New failures:
>> FAIL: gcc.target/riscv/zero-scratch-regs-2.c   -O3 -g 
>> scan-assembler-not \\mvsetvli
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O1 
>> scan-assembler-times vsetvli 1
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 
>> scan-assembler-times vsetvli 1
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 -flto 
>> -fno-use-linker-plugin -flto-partition=none scan-assembler-times 
>> vsetvli 1
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 -flto 
>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times 
>> vsetvli 1
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -Os 
>> scan-assembler-times vsetvli 1
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O1 
>> scan-assembler-times vsetvli 3
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O2 
>> scan-assembler-times vsetvli 3
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O2 -flto 
>> -fno-use-linker-plugin -flto-partition=none scan-assembler-times 
>> vsetvli 3
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O2 -flto 
>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times 
>> vsetvli 3
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -Os 
>> scan-assembler-times vsetvli 3
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O1 
>> scan-assembler-times vsetvli 4
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O2 
>> scan-assembler-times vsetvli 4
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O2 -flto 
>> -fno-use-linker-plugin -flto-partition=none scan-assembler-times 
>> vsetvli 4
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O2 -flto 
>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times 
>> vsetvli 4
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O1 
>> scan-assembler-times vsetvli 2
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O2 
>> scan-assembler-times vsetvli 2
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O2 -flto 
>> -fno-use-linker-plugin -flto-partition=none scan-assembler-times 
>> vsetvli 2
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O2 -flto 
>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times 
>> vsetvli 2
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -Os 
>> scan-assembler-times vsetvli 2
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O1 
>> scan-assembler-times vsetvli 2
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O2 
>> scan-assembler-times vsetvli 2
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O2 -flto 
>> -fno-use-linker-plugin -flto-partition=none scan-assembler-times 
>> vsetvli 2
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O2 -flto 
>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times 
>> vsetvli 2
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O1 
>> scan-assembler-times vsetvli 2
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O2 
>> scan-assembler-times vsetvli 2
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O2 -flto 
>> -fno-use-linker-plugin -flto-partition=none scan-assembler-times 
>> vsetvli 2
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O2 -flto 
>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times 
>> vsetvli 2
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -Os 
>> scan-assembler-times vsetvli 2
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-65.c   -O2 
>> scan-assembler-times vsetvli 3
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-65.c   -O2 -flto 
>> -fno-use-linker-plugin -flto-partition=none scan-assembler-times 
>> vsetvli 3
>> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-65.c   -O2 -flto 
>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times 
>> vsetvli 3
>> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O0 
>> scan-assembler-not vsetvli
>> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O1 
>> scan-assembler-not vsetvli
>> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2 
>> scan-assembler-not vsetvli
>> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2 -flto 
>> -fno-use-linker-plugin -flto-partition=none   scan-assembler-not vsetvli
>> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2 -flto 
>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-not vsetvli
>> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O3 -g 
>> scan-assembler-not vsetvli
>> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -Os 
>> scan-assembler-not vsetvli
>> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-10.c   -O3 -g 
>> scan-assembler-times vsetvli 15
>> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-11.c   -O3 -g 
>> scan-assembler-times vsetvli 3
>> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-12.c   -O3 -g 
>> scan-assembler-times vsetvli 9
>> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-13.c   -O3 -g 
>> scan-assembler-times vsetvli 9
>> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-14.c   -O3 -g 
>> scan-assembler-times vsetvli 1
>> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-15.c   -O3 -g 
>> scan-assembler-times vsetvli 4
>> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-16.c   -O3 -g 
>> scan-assembler-times vsetvli 15
>> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-18.c   -O3 -g 
>> scan-assembler-times vsetvli 3
>> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-19.c   -O3 -g 
>> scan-assembler-times vsetvli 15
>> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-9.c   -O3 -g 
>> scan-assembler-times vsetvli 15
>>
>> On 10/17/23 04:34, Lehua Ding wrote:
>>> This patch refactors and cleanups the vsetvl pass in order to make 
>>> the code
>>> easier to modify and understand. This patch does several things:
>>>
>>> 1. Introducing a virtual CFG for vsetvl infos and Phase 1, 2 and 3 
>>> only maintain
>>>     and modify this virtual CFG. Phase 4 performs insertion, 
>>> modification and
>>>     deletion of vsetvl insns based on the virtual CFG. The Basic 
>>> block in the
>>>     virtual CFG is called vsetvl_block_info and the vsetvl 
>>> information inside
>>>     is called vsetvl_info.
>>> 2. Combine Phase 1 and 2 into a single Phase 1 and unified the 
>>> demand system,
>>>     this Phase only fuse local vsetvl info in forward direction.
>>> 3. Refactor Phase 3, change the logic for determining whether to 
>>> uplift vsetvl
>>>     info to a pred basic block to a more unified method that there 
>>> is a vsetvl
>>>     info in the vsetvl defintion reaching in compatible with it.
>>> 4. Place all modification operations to the RTL in Phase 4 and Phase 5.
>>>     Phase 4 is responsible for inserting, modifying and deleting vsetvl
>>>     instructions based on fully optimized vsetvl infos. Phase 5 
>>> removes the avl
>>>     operand from the RVV instruction and removes the unused dest 
>>> operand
>>>     register from the vsetvl insns.
>>>
>>> These modifications resulted in some testcases needing to be 
>>> updated. The reasons
>>> for updating are summarized below:
>>>
>>> 1. more optimized
>>> vlmax_back_prop-25.c/vlmax_back_prop-26.c/vlmax_conflict-3.c/
>>>     vlmax_conflict-12.c/vsetvl-13.c/vsetvl-23.c/
>>> avl_single-23.c/avl_single-89.c/avl_single-95.c/pr109773-1.c
>>> 2. less unnecessary fusion
>>>     avl_single-46.c/imm_bb_prop-1.c/pr109743-2.c/vsetvl-18.c
>>> 3. local fuse direction (backward -> forward)
>>>     scalar_move-1.c/
>>> 4. add some bugfix testcases.
>>>     pr111037-3.c/pr111037-4.c
>>>     avl_single-89.c
>>>
>>>     PR target/111037
>>>     PR target/111234
>>>     PR target/111725
>>>
>>>
>>> Lehua Ding (14):
>>>    RISC-V: P1: Refactor avl_info/vl_vtype_info/vector_insn_info
>>>    RISC-V: P2: Refactor and cleanup demand system
>>>    RISC-V: P3: Refactor class vector_infos_manager to pre_vsetvl
>>>    RISC-V: P4: move method from class pass_vsetvl to pre_vsetvl
>>>    RISC-V: P5: combine phase 1 and 2 into a single pahse
>>>    RISC-V: P6: Add compute reaching definition data flow
>>>    RISC-V: P7: Move earliest fuse and lcm code to pre_vsetvl class
>>>    RISC-V: P8: Unified insert and delete of vsetvl insn into Phase 4
>>>    RISC-V: P9: Cleanup post optimize phase
>>>    RISC-V: P10: Cleanup helper functions
>>>    RISC-V: P11:  Refactor vector_block_info to vsetvl_block_info class
>>>    RISC-V: P12: Delete riscv-vsetvl.h
>>>    RISC-V: P13:  Reorganize functions used to modify RTL
>>>    RISC-V: P14: Adjust and add testcases
>>>
>>>   gcc/config/riscv/riscv-vsetvl.cc              | 6530 
>>> +++++++----------
>>>   gcc/config/riscv/riscv-vsetvl.def             |  634 +-
>>>   gcc/config/riscv/riscv-vsetvl.h               |  488 --
>>>   gcc/config/riscv/t-riscv                      |    2 +-
>>>   .../gcc.target/riscv/rvv/base/pr111037-2.c    |    8 -
>>>   .../gcc.target/riscv/rvv/base/scalar_move-1.c |    2 +-
>>>   .../riscv/rvv/vsetvl/avl_single-104.c         |   35 +
>>>   .../riscv/rvv/vsetvl/avl_single-105.c         |   23 +
>>>   .../riscv/rvv/vsetvl/avl_single-23.c          |    7 +-
>>>   .../riscv/rvv/vsetvl/avl_single-46.c          |    3 +-
>>>   .../riscv/rvv/vsetvl/avl_single-89.c          |    8 +-
>>>   .../riscv/rvv/vsetvl/avl_single-95.c          |    2 +-
>>>   .../riscv/rvv/vsetvl/imm_bb_prop-1.c          |    7 +-
>>>   .../gcc.target/riscv/rvv/vsetvl/pr109743-2.c  |    2 +-
>>>   .../gcc.target/riscv/rvv/vsetvl/pr109773-1.c  |    2 +-
>>>   .../gcc.target/riscv/rvv/vsetvl/pr111037-3.c  |   16 +
>>>   .../pr111037-1.c => vsetvl/pr111037-4.c}      |    5 +-
>>>   .../riscv/rvv/vsetvl/vlmax_back_prop-25.c     |   10 +-
>>>   .../riscv/rvv/vsetvl/vlmax_back_prop-26.c     |   10 +-
>>>   .../riscv/rvv/vsetvl/vlmax_conflict-12.c      |    1 -
>>>   .../riscv/rvv/vsetvl/vlmax_conflict-3.c       |    2 +-
>>>   .../gcc.target/riscv/rvv/vsetvl/vsetvl-13.c   |    4 +-
>>>   .../gcc.target/riscv/rvv/vsetvl/vsetvl-18.c   |    4 +-
>>>   .../gcc.target/riscv/rvv/vsetvl/vsetvl-23.c   |    2 +-
>>>   24 files changed, 3084 insertions(+), 4723 deletions(-)
>>>   delete mode 100644 gcc/config/riscv/riscv-vsetvl.h
>>>   delete mode 100644 
>>> gcc/testsuite/gcc.target/riscv/rvv/base/pr111037-2.c
>>>   create mode 100644 
>>> gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-104.c
>>>   create mode 100644 
>>> gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-105.c
>>>   create mode 100644 
>>> gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111037-3.c
>>>   rename gcc/testsuite/gcc.target/riscv/rvv/{base/pr111037-1.c => 
>>> vsetvl/pr111037-4.c} (74%)
>>>
>>> -- 
>>> 2.36.3
>>>
>>
>
  
Lehua Ding Oct. 19, 2023, 8:41 a.m. UTC | #5
Hi Partick,

Thank you so much for the details. I have send a V3 patchs here:

https://gcc.gnu.org/pipermail/gcc-patches/2023-October/633529.html

Can you use the new patchs to run the gcc testsuite again? I have fix 
some fails and fix the last patch of v2([PATCH V2 14/14]) which cannot 
apply normal since my editor automatically trim the ending space in the 
diff content and so it can't apply properly. Could you please see if it 
all works when applying these V3 patch, thank you very much. I am 
applying based on the commit id 
(0308461d9d44ca9db45fb72ca080c14e6fc68739) of trunk and no new fails.

On 2023/10/18 4:25, Patrick O'Neill wrote:
> Hi Lehua!
> 
> I ran the gcc testsuite on qemu before/after applying your patches to 
> 305034e3 rv32/64gcv [1].
> 
> Baseline
>                 ========= Summary of gcc testsuite =========
>                              | # of unexpected case / # of unique 
> unexpected case
>                              |          gcc |          g++ | gfortran |
>      rv32gcv/ ilp32d/ medlow |  208 /    78 |   29 /    17 |   71 /    24 |
>      rv64gcv/  lp64d/ medlow |  101 /    54 |   13 /     4 |   33 /    13 |
> 
> After applying patch series:
>                 ========= Summary of gcc testsuite =========
>                              | # of unexpected case / # of unique 
> unexpected case
>                              |          gcc |          g++ | gfortran |
>      rv32gcv/ ilp32d/ medlow |  256 /    96 |   29 /    17 |   69 /    23 |
>      rv64gcv/  lp64d/ medlow |  152 /    74 |   13 /     4 |   31 /    12 |
> 
> I'm seeing:
> 20 new unique gcc failures on rv64gcv [2]
> 18 new unique gcc failures on rv32gcv [3]
> 
> Thanks,
> Patrick
> 
> [1] Build commands:
> git clone https://github.com/patrick-rivos/riscv-gnu-toolchain.git
> cd riscv-gnu-toolchain
> git submodule update --init gcc
> cd gcc
> git checkout 305034e3
> cd ..
> mkdir build
> cd build
> ../configure --prefix=$(pwd) 
> --with-multilib-generator="rv64gcv-lp64d--;rv32gcv-ilp32d--"
> make report-linux -j32
> 
> Note: If you'd prefer to use upstream riscv-gnu-toolchain, I'm pretty 
> sure you can do
> mkdir build-64
> cd build-64
> ../configure --prefix=$(pwd) --with-arch=rv64gcv --with-abi=lp64d
> cd ..
> mkdir build-32
> cd build-32
> ../configure --prefix=$(pwd) --with-arch=rv32gcv --with-abi=lp32d
> This'll make 2 folders, so run make report-linux in each of them.
> 
> [2] rv64gcv New failures:
> FAIL: gcc.dg/vect/slp-7.c -flto -ffat-lto-objects execution test
> FAIL: gcc.dg/vect/slp-7.c execution test
> FAIL: gcc.target/riscv/zero-scratch-regs-2.c   -O3 -g scan-assembler-not 
> \\mvsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O1 
> scan-assembler-times vsetvli 1
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 
> scan-assembler-times vsetvli 1
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 1
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 1
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -Os 
> scan-assembler-times vsetvli 1
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O1 
> scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O2 
> scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -Os 
> scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O1 
> scan-assembler-times vsetvli 4
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O2 
> scan-assembler-times vsetvli 4
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 4
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 4
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O1 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O2 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -Os 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O1 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O2 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O1 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O2 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -Os 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-65.c   -O2 
> scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-65.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-65.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O0 scan-assembler-not 
> vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O1 scan-assembler-not 
> vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2 scan-assembler-not 
> vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-not vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-not vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O3 -g 
> scan-assembler-not vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -Os scan-assembler-not 
> vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-10.c   -O3 -g 
> scan-assembler-times vsetvli 15
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-11.c   -O3 -g 
> scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-12.c   -O3 -g 
> scan-assembler-times vsetvli 9
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-13.c   -O3 -g 
> scan-assembler-times vsetvli 9
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-14.c   -O3 -g 
> scan-assembler-times vsetvli 1
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-15.c   -O3 -g 
> scan-assembler-times vsetvli 4
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-16.c   -O3 -g 
> scan-assembler-times vsetvli 15
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-18.c   -O3 -g 
> scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-19.c   -O3 -g 
> scan-assembler-times vsetvli 15
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-9.c   -O3 -g 
> scan-assembler-times vsetvli 15
> 
> [3] rv32gcv New failures:
> FAIL: gcc.target/riscv/zero-scratch-regs-2.c   -O3 -g scan-assembler-not 
> \\mvsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O1 
> scan-assembler-times vsetvli 1
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 
> scan-assembler-times vsetvli 1
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 1
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 1
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-34.c   -Os 
> scan-assembler-times vsetvli 1
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O1 
> scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O2 
> scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-37.c   -Os 
> scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O1 
> scan-assembler-times vsetvli 4
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O2 
> scan-assembler-times vsetvli 4
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 4
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-38.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 4
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O1 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O2 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-47.c   -Os 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O1 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O2 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-48.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O1 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O2 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-49.c   -Os 
> scan-assembler-times vsetvli 2
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-65.c   -O2 
> scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-65.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times 
> vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-65.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O0 scan-assembler-not 
> vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O1 scan-assembler-not 
> vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2 scan-assembler-not 
> vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-not vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-not vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -O3 -g 
> scan-assembler-not vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/pr111037-2.c   -Os scan-assembler-not 
> vsetvli
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-10.c   -O3 -g 
> scan-assembler-times vsetvli 15
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-11.c   -O3 -g 
> scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-12.c   -O3 -g 
> scan-assembler-times vsetvli 9
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-13.c   -O3 -g 
> scan-assembler-times vsetvli 9
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-14.c   -O3 -g 
> scan-assembler-times vsetvli 1
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-15.c   -O3 -g 
> scan-assembler-times vsetvli 4
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-16.c   -O3 -g 
> scan-assembler-times vsetvli 15
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-18.c   -O3 -g 
> scan-assembler-times vsetvli 3
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-19.c   -O3 -g 
> scan-assembler-times vsetvli 15
> FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_single_block-9.c   -O3 -g 
> scan-assembler-times vsetvli 15
> 
> On 10/17/23 04:34, Lehua Ding wrote:
>> This patch refactors and cleanups the vsetvl pass in order to make the 
>> code
>> easier to modify and understand. This patch does several things:
>>
>> 1. Introducing a virtual CFG for vsetvl infos and Phase 1, 2 and 3 
>> only maintain
>>     and modify this virtual CFG. Phase 4 performs insertion, 
>> modification and
>>     deletion of vsetvl insns based on the virtual CFG. The Basic block 
>> in the
>>     virtual CFG is called vsetvl_block_info and the vsetvl information 
>> inside
>>     is called vsetvl_info.
>> 2. Combine Phase 1 and 2 into a single Phase 1 and unified the demand 
>> system,
>>     this Phase only fuse local vsetvl info in forward direction.
>> 3. Refactor Phase 3, change the logic for determining whether to 
>> uplift vsetvl
>>     info to a pred basic block to a more unified method that there is 
>> a vsetvl
>>     info in the vsetvl defintion reaching in compatible with it.
>> 4. Place all modification operations to the RTL in Phase 4 and Phase 5.
>>     Phase 4 is responsible for inserting, modifying and deleting vsetvl
>>     instructions based on fully optimized vsetvl infos. Phase 5 
>> removes the avl
>>     operand from the RVV instruction and removes the unused dest operand
>>     register from the vsetvl insns.
>>
>> These modifications resulted in some testcases needing to be updated. 
>> The reasons
>> for updating are summarized below:
>>
>> 1. more optimized
>>     vlmax_back_prop-25.c/vlmax_back_prop-26.c/vlmax_conflict-3.c/
>>     vlmax_conflict-12.c/vsetvl-13.c/vsetvl-23.c/
>>     avl_single-23.c/avl_single-89.c/avl_single-95.c/pr109773-1.c
>> 2. less unnecessary fusion
>>     avl_single-46.c/imm_bb_prop-1.c/pr109743-2.c/vsetvl-18.c
>> 3. local fuse direction (backward -> forward)
>>     scalar_move-1.c/
>> 4. add some bugfix testcases.
>>     pr111037-3.c/pr111037-4.c
>>     avl_single-89.c
>>
>>     PR target/111037
>>     PR target/111234
>>     PR target/111725
>>
>>
>> Lehua Ding (14):
>>    RISC-V: P1: Refactor avl_info/vl_vtype_info/vector_insn_info
>>    RISC-V: P2: Refactor and cleanup demand system
>>    RISC-V: P3: Refactor class vector_infos_manager to pre_vsetvl
>>    RISC-V: P4: move method from class pass_vsetvl to pre_vsetvl
>>    RISC-V: P5: combine phase 1 and 2 into a single pahse
>>    RISC-V: P6: Add compute reaching definition data flow
>>    RISC-V: P7: Move earliest fuse and lcm code to pre_vsetvl class
>>    RISC-V: P8: Unified insert and delete of vsetvl insn into Phase 4
>>    RISC-V: P9: Cleanup post optimize phase
>>    RISC-V: P10: Cleanup helper functions
>>    RISC-V: P11:  Refactor vector_block_info to vsetvl_block_info class
>>    RISC-V: P12: Delete riscv-vsetvl.h
>>    RISC-V: P13:  Reorganize functions used to modify RTL
>>    RISC-V: P14: Adjust and add testcases
>>
>>   gcc/config/riscv/riscv-vsetvl.cc              | 6530 +++++++----------
>>   gcc/config/riscv/riscv-vsetvl.def             |  634 +-
>>   gcc/config/riscv/riscv-vsetvl.h               |  488 --
>>   gcc/config/riscv/t-riscv                      |    2 +-
>>   .../gcc.target/riscv/rvv/base/pr111037-2.c    |    8 -
>>   .../gcc.target/riscv/rvv/base/scalar_move-1.c |    2 +-
>>   .../riscv/rvv/vsetvl/avl_single-104.c         |   35 +
>>   .../riscv/rvv/vsetvl/avl_single-105.c         |   23 +
>>   .../riscv/rvv/vsetvl/avl_single-23.c          |    7 +-
>>   .../riscv/rvv/vsetvl/avl_single-46.c          |    3 +-
>>   .../riscv/rvv/vsetvl/avl_single-89.c          |    8 +-
>>   .../riscv/rvv/vsetvl/avl_single-95.c          |    2 +-
>>   .../riscv/rvv/vsetvl/imm_bb_prop-1.c          |    7 +-
>>   .../gcc.target/riscv/rvv/vsetvl/pr109743-2.c  |    2 +-
>>   .../gcc.target/riscv/rvv/vsetvl/pr109773-1.c  |    2 +-
>>   .../gcc.target/riscv/rvv/vsetvl/pr111037-3.c  |   16 +
>>   .../pr111037-1.c => vsetvl/pr111037-4.c}      |    5 +-
>>   .../riscv/rvv/vsetvl/vlmax_back_prop-25.c     |   10 +-
>>   .../riscv/rvv/vsetvl/vlmax_back_prop-26.c     |   10 +-
>>   .../riscv/rvv/vsetvl/vlmax_conflict-12.c      |    1 -
>>   .../riscv/rvv/vsetvl/vlmax_conflict-3.c       |    2 +-
>>   .../gcc.target/riscv/rvv/vsetvl/vsetvl-13.c   |    4 +-
>>   .../gcc.target/riscv/rvv/vsetvl/vsetvl-18.c   |    4 +-
>>   .../gcc.target/riscv/rvv/vsetvl/vsetvl-23.c   |    2 +-
>>   24 files changed, 3084 insertions(+), 4723 deletions(-)
>>   delete mode 100644 gcc/config/riscv/riscv-vsetvl.h
>>   delete mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/pr111037-2.c
>>   create mode 100644 
>> gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-104.c
>>   create mode 100644 
>> gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-105.c
>>   create mode 100644 
>> gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111037-3.c
>>   rename gcc/testsuite/gcc.target/riscv/rvv/{base/pr111037-1.c => 
>> vsetvl/pr111037-4.c} (74%)
>>
>> -- 
>> 2.36.3
>>
>