Chain can be any operand
authorJim Laskey <jlaskey@mac.com>
Tue, 26 Sep 2006 09:32:41 +0000 (09:32 +0000)
committerJim Laskey <jlaskey@mac.com>
Tue, 26 Sep 2006 09:32:41 +0000 (09:32 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30611 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/DAGCombiner.cpp

index 9a78459edef677bbb63c0862693e9bfc498c7c72..32a81a044d88a7ebd0087e812fc19b69361e105a 100644 (file)
@@ -3956,17 +3956,15 @@ SDOperand DAGCombiner::BuildUDIV(SDNode *N) {
 ///  hasChainUsers - Returns true if one of the users of a load node has the
 ///  chain result as an operand.
 bool DAGCombiner::hasChainUsers(SDNode *Load) {
-  // Don't even bother if the load only has one user (conservatively the value.)
-  if (!Load->hasOneUse()) {
-    SDOperand Chain(Load, 1);  // The load's chain result.
-    
-    // For each user of the load.
-    for (SDNode::use_iterator UI = Load->use_begin(), UE = Load->use_end();
-         UI != UE; ++UI) {
-         
-      // Chain will be the first operand.
-      if ((*UI)->getOperand(0) == Chain)
-        return true;
+  SDOperand Chain(Load, 1);  // The load's chain result.
+  
+  // For each user of the load.
+  for (SDNode::use_iterator UI = Load->use_begin(), UE = Load->use_end();
+       UI != UE; ++UI) {
+    const SDNode *User = *UI;
+       
+    for (unsigned i = 0, e = User->getNumOperands(); i != e; ++i) {
+      if (User->getOperand(i) == Chain) return true;
     }
   }