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

via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 21 01:54:26 PDT 2026


================
@@ -317,6 +317,15 @@ struct MCSchedModel {
   unsigned MispredictPenalty;
   static const unsigned DefaultMispredictPenalty = 10;
 
+  // StoreLoadForwardingPenalty is the typical number of extra cycles a load
+  // stalls when hardware store-to-load forwarding fails (the load's bytes are
+  // not fully contained in a single, recent store, so it must wait for the
+  // store to drain to cache). A value of 0 means the target does not model
+  // this hazard. Consumed by the SLP vectorizer when a widened store would
+  // break forwarding for a nearby loop-carried load.
+  unsigned StoreLoadForwardingPenalty;
+  static const unsigned DefaultStoreLoadForwardingPenalty = 0;
----------------
mbhade-amd wrote:

Done — set the default penalty to a conservative 10 cycles (failed STLF stalls are ~10–15 cycles on current cores, so I took the minimum). No lit-test churn across X86/AArch64/RISCV in the SLPVectorizer suite.

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


More information about the llvm-commits mailing list