[llvm] [SLP] Add store-to-load forwarding conflict cost for widened store chains (PR #199606)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 13 12:01:41 PDT 2026


================
@@ -18049,6 +18085,18 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef<Value *> VectorizedVals,
               BaseSI->getPointerAddressSpace(), CostKind, OpInfo);
         }
       }
+      // Widening this store chain can break store-to-load forwarding for a
+      // nearby loop-carried load. Rather than reject the tree outright, add
+      // the target's modeled STLF penalty so a chain that is still profitable
+      // after paying it can vectorize. The penalty is a throughput/latency
+      // hazard, so only account for it under those cost kinds.
+      if (EnableSLPStoreLoadForwardCheck && E->State == TreeEntry::Vectorize &&
----------------
alexey-bataev wrote:

Same, check for other vectorize nodes (store-based)

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


More information about the llvm-commits mailing list