[llvm] [SelectionDAG][RISCV] Avoid store merging across function calls (PR #130430)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 17 09:15:47 PDT 2025


================
@@ -21553,6 +21553,56 @@ bool DAGCombiner::tryStoreMergeOfLoads(SmallVectorImpl<MemOpLink> &StoreNodes,
       JointMemOpVT = EVT::getIntegerVT(Context, SizeInBits);
     }
 
+    auto HasCallInLdStChain = [](SmallVectorImpl<MemOpLink> &StoreNodes,
+                                 SmallVectorImpl<MemOpLink> &LoadNodes,
+                                 unsigned NumStores) {
+      for (unsigned i = 0; i < NumStores; ++i) {
+        StoreSDNode *St = cast<StoreSDNode>(StoreNodes[i].MemNode);
+        SDValue Val = peekThroughBitcasts(St->getValue());
+        LoadSDNode *Ld = cast<LoadSDNode>(Val);
+        assert(Ld == LoadNodes[i].MemNode && "Load and store mismatch");
----------------
lukel97 wrote:

Argh woops, yes Ld should be LoadSDNode not StoreSDNode!

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


More information about the llvm-commits mailing list