[all-commits] [llvm/llvm-project] 020812: Reapply "[RISCV][InsertVSETVLI] Avoid VL toggles f...

Philip Reames via All-commits all-commits at lists.llvm.org
Wed May 10 11:52:12 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 020812b64f2338a0e96d6d2a358d075bf942986f
      https://github.com/llvm/llvm-project/commit/020812b64f2338a0e96d6d2a358d075bf942986f
  Author: Philip Reames <preames at rivosinc.com>
  Date:   2023-05-10 (Wed, 10 May 2023)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
    M llvm/test/CodeGen/RISCV/rvv/extractelt-i1.ll
    M llvm/test/CodeGen/RISCV/rvv/fixed-vector-shuffle-reverse.ll
    M llvm/test/CodeGen/RISCV/rvv/fixed-vectors-extract-i1.ll
    M llvm/test/CodeGen/RISCV/rvv/fixed-vectors-extract.ll
    M llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fp.ll
    M llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fp2i-sat.ll
    M llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fp2i.ll
    M llvm/test/CodeGen/RISCV/rvv/fixed-vectors-i2fp.ll
    M llvm/test/CodeGen/RISCV/rvv/fixed-vectors-masked-gather.ll
    M llvm/test/CodeGen/RISCV/rvv/fixed-vectors-masked-scatter.ll
    M llvm/test/CodeGen/RISCV/rvv/fold-vector-cmp.ll
    M llvm/test/CodeGen/RISCV/rvv/shuffle-reverse.ll
    M llvm/test/CodeGen/RISCV/rvv/vector-splice.ll
    M llvm/test/CodeGen/RISCV/rvv/vsplats-i1.ll
    M llvm/test/CodeGen/RISCV/urem-seteq-illegal-types.ll

  Log Message:
  -----------
  Reapply "[RISCV][InsertVSETVLI] Avoid VL toggles for extractelement patterns"

The original change had a bug where it allowed SEW mutation.  This is wrong in multiple ways, but an easy example is that the slide amount is in units of SEW, and thus that changing SEW changes the slide offset.

I'd reverted this in 33314693 intending to more majorly rework the patch because in addition to the bug, I'd noticed a potential oppurtunity to increase scope.  After implementing that variant, and realizing it triggered nowhere, I decided to go back to the prior patch with the minimal fix.

Note there's no separate test case for the fix.  This is because we already had multiple, and I just didn't realize the impact of the original test diff.  Adding one more test would have been unlikely to catch that human error.

Original commit message..

Noticed this while looking at some SLP output. If we have an extractelement, we're probably using a slidedown into an destination with no contents. Given this, we can allow the slideup to use a larger VL and clobber tail elements of the destination vector. Doing this allows us to avoid vsetvli toggles in many fixed length vector examples.

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




More information about the All-commits mailing list