[llvm-branch-commits] [llvm] [LoopVectorize] Support vectorization of compressing patterns (PR #214491)

Andrei Elovikov via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Aug 17 11:19:18 PDT 2026


================
@@ -2649,8 +2663,11 @@ LoopVectorizationCostModel::memoryInstructionCanBeWidened(Instruction *I,
   auto *Ptr = getLoadStorePointerOperand(I);
   auto *ScalarTy = getLoadStoreType(I);
 
-  // In order to be widened, the pointer should be consecutive, first of all.
+  // In order to be widened, the pointer should be consecutive or compressed.
   int Stride = Legal->isConsecutivePtr(ScalarTy, Ptr);
+  if (!Stride && Legal->isCompressedLoadOrStore(I))
+    Stride = 1;
----------------
eas wrote:

I don't like hardcoding this here. The stride restriction is coming from the descriptor implementation, and if we remove it there there is no "easy" way to find this line. I believe `const DenseMap<Instruction *, const SCEV *> &getCompressedMemoryOps()` contains enough data to make stride computation here generic already so that we could at least assert for `Stride == 1`.

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


More information about the llvm-branch-commits mailing list