[llvm] [LAA] Support different strides & non constant dep distances using SCEV. (PR #88039)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 17 13:19:47 PDT 2024


================
@@ -126,8 +126,10 @@ struct StoreToLoadForwardingCandidate {
 
     // We don't need to check non-wrapping here because forward/backward
     // dependence wouldn't be valid if these weren't monotonic accesses.
-    auto *Dist = cast<SCEVConstant>(
+    auto *Dist = dyn_cast<SCEVConstant>(
         PSE.getSE()->getMinusSCEV(StorePtrSCEV, LoadPtrSCEV));
+    if (!Dist)
+      return false;
----------------
fhahn wrote:

Yes, the pass uses LoopAccessInfo in `findStoreToLoadDependences` to collect dependences. Before this patch, all identified dependences would have a constant distance which is why this change is needed

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


More information about the llvm-commits mailing list