[all-commits] [llvm/llvm-project] 072280: [RISCV] Match constant indices of non-index type w...

Philip Reames via All-commits all-commits at lists.llvm.org
Mon Sep 18 09:41:58 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 07228002891c5b970b8f5a0040adf3176b168171
  Author: Philip Reames <preames at rivosinc.com>
  Date:   2023-09-18 (Mon, 18 Sep 2023)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVGatherScatterLowering.cpp
    M llvm/test/CodeGen/RISCV/rvv/fixed-vectors-masked-gather.ll
    M llvm/test/CodeGen/RISCV/rvv/fixed-vectors-masked-scatter.ll

  Log Message:
  [RISCV] Match constant indices of non-index type when forming strided ops (#65777)

When checking to see if our index expressions can be converted into strided
operations, we previously gave up if the index type wasn't an exact match for
the intptrty for the address. Per gep semantics, this mismatch implies a sext
or trunc cast to the respective index type. For constants, go ahead and
evaluate that cast instead of giving up.

Note that the motivation of this is mostly test cleanup. We canonicalize at IR
such that the gep index will match the intptrty. This is mostly useful so that
we can write both RV32 and RV64 tests from the same source. Its also helpful in
preventing confusion - I've stumbled across this at least four times now and
wasted time each one.

Note: The test change for scatters unit stride cases contains a minor
regression for rv32 and 64 bit indices.  This is an artifact of order in which
changes are landing.  This will be addressed in a near future change for all

More information about the All-commits mailing list