OSDN Git Service

Make early exit hasPredecessorHelper return true. NFCI.
authorNirav Dave <niravd@google.com>
Fri, 9 Mar 2018 20:56:51 +0000 (20:56 +0000)
committerNirav Dave <niravd@google.com>
Fri, 9 Mar 2018 20:56:51 +0000 (20:56 +0000)
All uses conservatively assume in early exit case that it will be a
predecessor. Changing default removes checking code in all uses.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327169 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/SelectionDAGNodes.h
lib/CodeGen/SelectionDAG/DAGCombiner.cpp

index ab25b8a..a2bead3 100644 (file)
@@ -820,7 +820,7 @@ public:
       if (Found)
         return true;
       if (MaxSteps != 0 && Visited.size() >= MaxSteps)
-        return false;
+        return true;
     }
     return false;
   }
index ba06f62..d0e2f91 100644 (file)
@@ -13102,14 +13102,10 @@ bool DAGCombiner::checkMergeStoreCandidatesForDependencies(
       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;
 }