[PATCH] D11107: DAGCombiner: Don't search up chain through non-memory dependencies

Matt Arsenault Matthew.Arsenault at amd.com
Fri Jul 10 13:21:12 PDT 2015


arsenm created this revision.
arsenm added a reviewer: hfinkel.
arsenm added a subscriber: llvm-commits.

This is to try to fix the problem described here :http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20150622/284139.html

http://reviews.llvm.org/D11107

Files:
  lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Index: lib/CodeGen/SelectionDAG/DAGCombiner.cpp
===================================================================
--- lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -14012,10 +14012,23 @@
         DEBUG(dbgs() << "Load alias\n");
         Aliases.push_back(Chain);
       } else {
-        // Look further up the chain.
+        SDValue NextChain = Chain.getOperand(0);
+
+        if (!isa<MemSDNode>(NextChain)) {
+          // Don't continue the search if we see a chain dependency that isn't a
+          // memory access.
+          //
+          // e.g. we could have a dependency on a CopyFromReg into the pointer
+          // value of a load.
+          Chains.push_back(Chain);
+          break;
+        }
+
+        // Look further up the chain at possible memory dependencies.
+        Chains.push_back(NextChain);
         DEBUG(dbgs() << "Look up load / store chain: ");
-        Chain.getOperand(0)->dump(&DAG);
-        Chains.push_back(Chain.getOperand(0));
+        NextChain->dump(&DAG);
+        Chains.push_back(NextChain);
         ++Depth;
       }
       break;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11107.29484.patch
Type: text/x-patch
Size: 1130 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150710/ef06e68e/attachment.bin>


More information about the llvm-commits mailing list