[llvm] [IA][RISCV] Recognize deinterleaved loads that could lower to strided segmented loads (PR #151612)

Min-Yih Hsu via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 6 09:26:48 PDT 2025


================
@@ -3209,10 +3209,12 @@ class LLVM_ABI TargetLoweringBase {
   /// \p Shuffles is the shufflevector list to DE-interleave the loaded vector.
   /// \p Indices is the corresponding indices for each shufflevector.
   /// \p Factor is the interleave factor.
+  /// \p MaskFactor is the interleave factor that considers mask, which can
+  /// reduce the original factor.
   virtual bool lowerInterleavedLoad(Instruction *Load, Value *Mask,
                                     ArrayRef<ShuffleVectorInst *> Shuffles,
-                                    ArrayRef<unsigned> Indices,
-                                    unsigned Factor) const {
+                                    ArrayRef<unsigned> Indices, unsigned Factor,
+                                    unsigned MaskFactor) const {
     return false;
----------------
mshockwave wrote:

> Targets that don't support strided interleaved loads would check that `Stride == DL.getTypeStoreSize(VTy->getElementType())`

I believe stride is relative to the current start address, so in the case of skipping fields, the stride will always be `Factor * DL.getTypeStoreSize(VTy->getElementType())` regardless of how many fields you wanna skip.
But I guess my more high-level question would be: for those targets that don't support strided interleaved loads, what is the benefit of replacing a check between Factor and MaskFactor with another check on Stride ?

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


More information about the llvm-commits mailing list