[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
Fri Sep 11 03:52:25 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 &&
+ (CostKind == TTI::TCK_RecipThroughput ||
+ CostKind == TTI::TCK_Latency) &&
+ findStoreLoadForwardingConflict(
+ BaseSI,
+ E->getVectorFactor() * std::max(1u, E->getInterleaveFactor())))
----------------
alexey-bataev wrote:
```suggestion
E->Scalars.size() * std::max(1u, E->getInterleaveFactor())))
```
https://github.com/llvm/llvm-project/pull/199606
More information about the llvm-commits
mailing list