summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-07-09 23:03:14 +0000
committerDan Gohman <gohman@apple.com>2008-07-09 23:03:14 +0000
commit7d94c49db9a5975925253cb97129064fdeeaaec7 (patch)
treec7c1b4dd1f6920bf62e7cf9d891b523ed3590e12 /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
parent832e8988035abf77cabb401057dcd6b9a5279200 (diff)
downloadbcm5719-llvm-7d94c49db9a5975925253cb97129064fdeeaaec7.tar.gz
bcm5719-llvm-7d94c49db9a5975925253cb97129064fdeeaaec7.zip
Simplify hasNUsesOfValue and hasAnyUsesOfValue even more. This
makes their special-case checks of use_size() less beneficial, so remove them. This eliminates all but one use of use_size(), which is in AssignTopologicalOrder, which uses it only once for each node, and so can reasonably afford to recompute it, as this allows the UsesSize field of SDNode to be removed altogether. llvm-svn: 53377
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp16
1 files changed, 2 insertions, 14 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 0eb92967555..d98f1fa215a 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -3749,7 +3749,6 @@ void SDNode::MorphNodeTo(unsigned Opc, SDVTList L,
OperandList[i].setUser(this);
SDNode *N = OperandList[i].getVal();
N->addUser(i, this);
- ++N->UsesSize;
DeadNodeSet.erase(N);
}
@@ -4394,16 +4393,9 @@ const MVT *SDNode::getValueTypeList(MVT VT) {
bool SDNode::hasNUsesOfValue(unsigned NUses, unsigned Value) const {
assert(Value < getNumValues() && "Bad value!");
- // If there is only one value, this is easy.
- if (getNumValues() == 1)
- return use_size() == NUses;
- if (use_size() < NUses) return false;
-
- SDOperand TheValue(const_cast<SDNode *>(this), Value);
-
// 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) {
+ if (UI->getSDOperand().ResNo == Value) {
if (NUses == 0)
return false;
--NUses;
@@ -4420,12 +4412,8 @@ bool SDNode::hasNUsesOfValue(unsigned NUses, unsigned Value) const {
bool SDNode::hasAnyUseOfValue(unsigned Value) const {
assert(Value < getNumValues() && "Bad value!");
- if (use_empty()) return false;
-
- SDOperand TheValue(const_cast<SDNode *>(this), Value);
-
for (SDNode::use_iterator UI = use_begin(), E = use_end(); UI != E; ++UI)
- if (UI->getSDOperand() == TheValue)
+ if (UI->getSDOperand().ResNo == Value)
return true;
return false;
OpenPOWER on IntegriCloud