[PATCH] D61511: [DAGCombiner] Limit number of nodes explored as store candidates.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 6 12:37:12 PDT 2019


fhahn updated this revision to Diff 198324.
fhahn marked 3 inline comments as done.
fhahn added a comment.

Updated increments.

In D61511#1491339 <https://reviews.llvm.org/D61511#1491339>, @niravd wrote:

> This is okay modulo nits, but let's land the TokenFactor operand size limiting first as it also implicitly bounds things.


Thanks, the token factor size limiting patch is at D61397 <https://reviews.llvm.org/D61397>, please let me know what you think and
if there is a better place to do the limiting somewhere else.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61511/new/

https://reviews.llvm.org/D61511

Files:
  llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp


Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -14835,9 +14835,11 @@
 
   RootNode = St->getChain().getNode();
 
+  unsigned NumNodesExplored = 0;
   if (LoadSDNode *Ldn = dyn_cast<LoadSDNode>(RootNode)) {
     RootNode = Ldn->getChain().getNode();
-    for (auto I = RootNode->use_begin(), E = RootNode->use_end(); I != E; ++I)
+    for (auto I = RootNode->use_begin(), E = RootNode->use_end();
+         I != E && NumNodesExplored < 1024; ++I, ++NumNodesExplored)
       if (I.getOperandNo() == 0 && isa<LoadSDNode>(*I)) // walk down chain
         for (auto I2 = (*I)->use_begin(), E2 = (*I)->use_end(); I2 != E2; ++I2)
           if (I2.getOperandNo() == 0)
@@ -14848,7 +14850,8 @@
                 StoreNodes.push_back(MemOpLink(OtherST, PtrDiff));
             }
   } else
-    for (auto I = RootNode->use_begin(), E = RootNode->use_end(); I != E; ++I)
+    for (auto I = RootNode->use_begin(), E = RootNode->use_end();
+         I != E && NumNodesExplored < 1024; ++I, ++NumNodesExplored)
       if (I.getOperandNo() == 0)
         if (StoreSDNode *OtherST = dyn_cast<StoreSDNode>(*I)) {
           BaseIndexOffset Ptr;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61511.198324.patch
Type: text/x-patch
Size: 1304 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190506/ab4f8cc4/attachment.bin>


More information about the llvm-commits mailing list