[all-commits] [llvm/llvm-project] 220a00: [SDAG] Prefer scalar for prefix of vector GEP expa...

Philip Reames via All-commits all-commits at lists.llvm.org
Wed Jul 2 18:16:50 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 220a00239696257a02fe625a4819fcd038e9dd07
      https://github.com/llvm/llvm-project/commit/220a00239696257a02fe625a4819fcd038e9dd07
  Author: Philip Reames <preames at rivosinc.com>
  Date:   2025-07-02 (Wed, 02 Jul 2025)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
    M llvm/test/CodeGen/AArch64/ptradd.ll
    M llvm/test/CodeGen/RISCV/rvv/mgather-sdnode.ll

  Log Message:
  -----------
  [SDAG] Prefer scalar for prefix of vector GEP expansion (#146719)

When generating SDAG for a getelementptr with a vector result, we were
previously generating splats for each scalar operand. This essentially
has the effect of aggressively vectorizing the sequence, and leaving it
later combines to scalarize if profitable.

Instead, we can keep the accumulating address as a scalar for as long as
the prefix of operands allows before lazily converting to vector on the
first vector operand. This both better fits hardware which frequently
has a scalar base on the scatter/gather instructions, and reduces the
addressing cost even when not as otherwise we end up with a scalar to
vector domain crossing for each scalar operand.

Note that constant splat offsets are treated as scalar for the above,
and only variable offsets can force a conversion to vector.

---------

Co-authored-by: Craig Topper <craig.topper at sifive.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list