[llvm] r327169 - Make early exit hasPredecessorHelper return true. NFCI.

Nirav Dave via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 9 12:56:51 PST 2018


Author: niravd
Date: Fri Mar  9 12:56:51 2018
New Revision: 327169

URL: http://llvm.org/viewvc/llvm-project?rev=327169&view=rev
Log:
Make early exit hasPredecessorHelper return true. NFCI.

All uses conservatively assume in early exit case that it will be a
predecessor. Changing default removes checking code in all uses.

Modified:
    llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
    llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=327169&r1=327168&r2=327169&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original)
+++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Fri Mar  9 12:56:51 2018
@@ -820,7 +820,7 @@ public:
       if (Found)
         return true;
       if (MaxSteps != 0 && Visited.size() >= MaxSteps)
-        return false;
+        return true;
     }
     return false;
   }

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=327169&r1=327168&r2=327169&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Fri Mar  9 12:56:51 2018
@@ -13102,14 +13102,10 @@ bool DAGCombiner::checkMergeStoreCandida
       Worklist.push_back(n->getOperand(j).getNode());
   }
   // Search through DAG. We can stop early if we find a store node.
-  for (unsigned i = 0; i < NumStores; ++i) {
+  for (unsigned i = 0; i < NumStores; ++i)
     if (SDNode::hasPredecessorHelper(StoreNodes[i].MemNode, Visited, Worklist,
                                      Max))
       return false;
-    // Check if we ended early, failing conservatively if so.
-    if (Visited.size() >= Max)
-      return false;
-  }
   return true;
 }
 




More information about the llvm-commits mailing list