[llvm] [SLP] More accurately cost RISCV scalar splats (PR #213104)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 31 04:05:12 PDT 2026
================
@@ -2561,6 +2563,12 @@ InstructionCost RISCVTTIImpl::getVectorInstrCost(
return BaseT::getVectorInstrCost(Opcode, Val, CostKind, Index, Op0, Op1,
VIC);
+ // Scalar splat operand can be folded for vector ops that support splatting
+ // the scalar operand, so the explicit insertelement is free in this context.
+ if (Opcode == Instruction::InsertElement &&
----------------
alexey-bataev wrote:
Add a check/assertion that insert index is zero
https://github.com/llvm/llvm-project/pull/213104
More information about the llvm-commits
mailing list