[llvm] [SLP] Bail out on store-to-load forwarding hazards (PR #199606)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 11 12:06:27 PDT 2026


================
@@ -171,11 +175,20 @@ struct SLPVectorizerPass : public OptionalPassInfoMixin<SLPVectorizerPass> {
                                           unsigned Idx, unsigned MinVF,
                                           unsigned &Size);
 
+  /// Returns true if vectorizing the store chain would cause store-to-load
+  /// forwarding conflicts due to short loop-carried dependence distances.
+  bool hasStoreLoadForwardingConflict(ArrayRef<Value *> Chain, unsigned VF);
+
   bool vectorizeStores(
       ArrayRef<StoreInst *> Stores, slpvectorizer::BoUpSLP &R,
       DenseSet<std::tuple<Value *, Value *, Value *, Value *, unsigned>>
           &Visited);
 
+  /// Cached STLF conflict decisions keyed by (first store in chain, VF).
+  /// Avoids re-walking the LAA dependence list when the same chain is retried
+  /// at multiple vector factors.
+  DenseMap<std::pair<const StoreInst *, unsigned>, bool> StlfConflictCache;
----------------
alexey-bataev wrote:

```suggestion
  SmallDenseMap<std::pair<const StoreInst *, unsigned>, bool> StlfConflictCache;
```

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


More information about the llvm-commits mailing list