From: Dan Gohman Date: Wed, 9 Jul 2008 22:39:01 +0000 (+0000) Subject: hasAnyUseOfValue can check SDUse nodes of its users directly instead X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=1373c1c3951ddd785d4f7f83c0bc89df699d22a0;p=oota-llvm.git hasAnyUseOfValue can check SDUse nodes of its users directly instead of examining every operand of every user. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53374 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index fc70c19ff6d..0eb92967555 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -4401,8 +4401,6 @@ bool SDNode::hasNUsesOfValue(unsigned NUses, unsigned Value) const { SDOperand TheValue(const_cast(this), Value); - SmallPtrSet UsersHandled; - // TODO: Only iterate over uses of a given value of the node for (SDNode::use_iterator UI = use_begin(), E = use_end(); UI != E; ++UI) { if (*UI == TheValue) { @@ -4426,17 +4424,9 @@ bool SDNode::hasAnyUseOfValue(unsigned Value) const { SDOperand TheValue(const_cast(this), Value); - SmallPtrSet UsersHandled; - - for (SDNode::use_iterator UI = use_begin(), E = use_end(); UI != E; ++UI) { - SDNode *User = UI->getUser(); - if (User->getNumOperands() == 1 || - UsersHandled.insert(User)) // First time we've seen this? - for (unsigned i = 0, e = User->getNumOperands(); i != e; ++i) - if (User->getOperand(i) == TheValue) { - return true; - } - } + for (SDNode::use_iterator UI = use_begin(), E = use_end(); UI != E; ++UI) + if (UI->getSDOperand() == TheValue) + return true; return false; }