[all-commits] [llvm/llvm-project] d85e34: [RISCV] Add a pass to recognize VLS strided loads/...

Craig Topper via All-commits all-commits at lists.llvm.org
Mon Sep 20 09:39:58 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d85e347a28dc9a329d7029987e4e062428985b41
      https://github.com/llvm/llvm-project/commit/d85e347a28dc9a329d7029987e4e062428985b41
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2021-09-20 (Mon, 20 Sep 2021)

  Changed paths:
    M llvm/include/llvm/IR/IntrinsicsRISCV.td
    M llvm/lib/Target/RISCV/CMakeLists.txt
    M llvm/lib/Target/RISCV/RISCV.h
    A llvm/lib/Target/RISCV/RISCVGatherScatterLowering.cpp
    M llvm/lib/Target/RISCV/RISCVISelLowering.cpp
    M llvm/lib/Target/RISCV/RISCVISelLowering.h
    M llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
    M llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
    A llvm/test/CodeGen/RISCV/rvv/fixed-vector-strided-load-store-negative.ll
    A llvm/test/CodeGen/RISCV/rvv/fixed-vector-strided-load-store.ll
    M llvm/tools/opt/opt.cpp

  Log Message:
  -----------
  [RISCV] Add a pass to recognize VLS strided loads/store from gather/scatter.

For strided accesses the loop vectorizer seems to prefer creating a
vector induction variable with a start value of the form
<i32 0, i32 1, i32 2, ...>. This value will be incremented each
loop iteration by a splat constant equal to the length of the vector.
Within the loop, arithmetic using splat values will be done on this
vector induction variable to produce indices for a vector GEP.

This pass attempts to dig through the arithmetic back to the phi
to create a new scalar induction variable and a stride. We push
all of the arithmetic out of the loop by folding it into the start,
step, and stride values. Then we create a scalar GEP to use as the
base pointer for a strided load or store using the computed stride.
Loop strength reduce will run after this pass and can do some
cleanups to the scalar GEP and induction variable.

Reviewed By: frasercrmck

Differential Revision: https://reviews.llvm.org/D107790




More information about the All-commits mailing list