[RISCV] Hoist VSETVLI vlmax, vtype out of scalable loops
authorPhilip Reames <preames@rivosinc.com>
Wed, 25 May 2022 15:00:27 +0000 (08:00 -0700)
committerPhilip Reames <listmail@philipreames.com>
Wed, 25 May 2022 15:00:27 +0000 (08:00 -0700)
commit2a3b6f2cba92e884969a914917839242eb26809b
tree27bea79ec4efc7e740f3b51fbf438395d8a2fbe1
parentdd336b6891f1e4be1aae2b7e30c1ba7318564812
[RISCV] Hoist VSETVLI vlmax, vtype out of scalable loops

This is a straight forward extension of the PRE transform introduced in D124869 to handle the VLMAX case.

The test changes here look quite positive. This surprised me until I realized that all the tests are using @llvm.vscale to figure out the VLMAX, not the llvm.riscv.vsetvlmax intrinsic. If they'd used the later, these would have been full redundancy cases and fully handled by the data flow. I'm not really sure if use of vscale here is representative or not. If it is, we should probably look at using VSETVLI to lower vscale rather than a raw read of vlenb and some math.

Differential Revision: https://reviews.llvm.org/D126338
llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
llvm/test/CodeGen/RISCV/rvv/sink-splat-operands.ll