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

via llvm-commits llvm-commits at lists.llvm.org
Tue May 26 23:54:05 PDT 2026


mbhade-amd wrote:

> Can we reuse LAA instead?

Thanks Alexey — I looked at _MemoryDepChecker::couldPreventStoreLoadForward_ to figure out how much we could share, and I think the right answer is "share the inner predicate, not the function".

The two checks ask different questions:

LAA's helper iterates VF = 2*TypeByteSize, 4*TypeByteSize, ... and answers "what is the largest VF that doesn't stall STLF, and is that below 2 × TypeByteSize?". It returns true only when even VF=2 conflicts and also mutates MaxStoreLoadForwardSafeDistanceInBits as a side effect. It's a private member of MemoryDepChecker.

In SLP we already know the candidate VF (chain length × element size), so we want the per-VF predicate — "does this specific width stall?". There's no need to search VFs, no MaxVFInBits to update, and the answer is just true/false for the chain at hand.
Reusing LAA wholesale would also require adding LAA to SLP's pass dependencies and running full per-loop dependence analysis just to read out one byte-distance check, which is more than we need.

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


More information about the llvm-commits mailing list