[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
Tue Sep 8 05:56:08 PDT 2026
================
@@ -19447,6 +19476,27 @@ BoUpSLP::calculateTreeCostAndTrimNonProfitable(ArrayRef<Value *> VectorizedVals,
"Expected gather nodes with users only.");
InstructionCost C = getEntryCost(&TE, VectorizedVals, CheckedExtracts);
+ // Also model hazards introduced by a vector load node when the relevant
+ // stores are not part of the current vectorized store tree.
+ if (EnableSLPStoreLoadForwardCheck && TE.hasState() &&
+ TE.State == TreeEntry::Vectorize &&
+ TE.getOpcode() == Instruction::Load &&
+ (CostKind == TTI::TCK_RecipThroughput ||
+ CostKind == TTI::TCK_Latency)) {
+ auto *BaseLoad = cast<LoadInst>(TE.getMainOp());
+ if (findStoreLoadForwardingHazardForLoad(BaseLoad,
+ TE.getVectorFactor())) {
+ Type *VecTy = getWidenedType(BaseLoad->getType(), TE.getVectorFactor());
----------------
alexey-bataev wrote:
```suggestion
Type *VecTy = getWidenedType(BaseLoad->getType(), TE.Scalars.size());
```
https://github.com/llvm/llvm-project/pull/199606
More information about the llvm-commits
mailing list