[llvm] [LV] Vectorize bounded (i % 2^N) loads in read only loops w/o RT checks. (PR #207279)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 3 08:09:10 PDT 2026


================
@@ -2427,8 +2428,10 @@ bool LoopVectorizationCostModel::isScalarWithPredication(Instruction *I,
   }
   case Instruction::Load:
   case Instruction::Store: {
-    bool IsConsecutive = Legal->isConsecutivePtr(getLoadStoreType(I),
-                                                 getLoadStorePointerOperand(I));
+    bool IsConsecutive =
+        Legal->getBoundForConsecutiveLoad(I) != 0 ||
+        Legal->isConsecutivePtr(getLoadStoreType(I),
+                                getLoadStorePointerOperand(I)) != 0;
----------------
artagnon wrote:

```suggestion
        Legal->getBoundForConsecutiveLoad(I) ||
        Legal->isConsecutivePtr(getLoadStoreType(I),
                                getLoadStorePointerOperand(I));
```

Clearer?

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


More information about the llvm-commits mailing list