diff options
author | Dan Gohman <gohman@apple.com> | 2008-07-09 22:39:01 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2008-07-09 22:39:01 +0000 |
commit | 7a510c29907154ea12df61f61e173774801e7efd (patch) | |
tree | 722905607ec1f13e5d66603c066cdde4c7480234 /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | |
parent | a3f878dcab97d067beb0af78bc8b464c5558e838 (diff) | |
download | bcm5719-llvm-7a510c29907154ea12df61f61e173774801e7efd.tar.gz bcm5719-llvm-7a510c29907154ea12df61f61e173774801e7efd.zip |
hasAnyUseOfValue can check SDUse nodes of its users directly instead
of examining every operand of every user.
llvm-svn: 53374
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index fc70c19ff6d..0eb92967555 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -4401,8 +4401,6 @@ bool SDNode::hasNUsesOfValue(unsigned NUses, unsigned Value) const { SDOperand TheValue(const_cast<SDNode *>(this), Value); - SmallPtrSet<SDNode*, 32> 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<SDNode *>(this), Value); - SmallPtrSet<SDNode*, 32> 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; } |