[llvm] [VectorCombine] Align shrinkLoadForShuffles to register boundaries (PR #209775)

Timur Golubovich via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 22 05:31:55 PDT 2026


================
@@ -6199,6 +6199,38 @@ bool VectorCombine::foldBitOrderReverseAndSwap(Instruction &I) {
   replaceValue(I, *CastToOrig);
   return true;
 }
+
+/// Given the maximum shuffle index and load vector type, compute the number of
+/// elements for the shrunk load, rounding up to the next full vector register
+/// boundary to avoid scalar remainders that legalize poorly.
+static unsigned getAlignedNumElements(unsigned MaxIdx, FixedVectorType *LoadTy,
+                                      const TargetTransformInfo &TTI,
+                                      const DataLayout *DL) {
+  unsigned RawNumElements = MaxIdx + 1u;
+  // Preserve the default behavior for scalable-vector targets.
----------------
timurgol007 wrote:

@arsenm, addressed, now they are handled by `isScalable()` checks

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


More information about the llvm-commits mailing list