[llvm] [SLP] More accurately cost RISCV scalar splats (PR #213104)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 12 05:42:00 PDT 2026


================
@@ -1074,10 +1076,26 @@ class TargetTransformInfo {
 
   using VectorInstrContext = llvm::VectorInstrContext;
 
+  /// Stores information about the uses of a build vector
+  struct BuildVectorUseOp {
+    unsigned Opcode;
+    int OperandIndex;
+  };
+
   /// Calculates a VectorInstrContext from \p I.
   LLVM_ABI static VectorInstrContext
   getVectorInstrContextHint(const Instruction *I);
 
+  /// Calculates a VectorInstrContext for buildvector-like gather sequences.
+  ///
+  /// \p GatherUserOps must collect all users of \p Scalars relevant for
+  /// determining whether a splat can be folded as a scalar operand. It returns
+  /// false if those users cannot be gathered in the required form.
+  LLVM_ABI VectorInstrContext getBuildVectorContextHint(
----------------
alexey-bataev wrote:

Shall it be static?

https://github.com/llvm/llvm-project/pull/213104


More information about the llvm-commits mailing list