aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/CodeGen
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-07-07 20:57:48 +0000
committerDan Gohman <gohman@apple.com>2008-07-07 20:57:48 +0000
commit0fe9c6e7babb3c0731d9cb864ec498ec4184760f (patch)
tree379b6151e0b3a8c3be5b8bdb20de1afe162eaead /include/llvm/CodeGen
parentce42e404a26454f4332c2c350c75ad27bbbb16f7 (diff)
downloadexternal_llvm-0fe9c6e7babb3c0731d9cb864ec498ec4184760f.tar.gz
external_llvm-0fe9c6e7babb3c0731d9cb864ec498ec4184760f.tar.bz2
external_llvm-0fe9c6e7babb3c0731d9cb864ec498ec4184760f.zip
Fix SDNode::MorphNodeTo (a function used by by SelectNodeTo) to
properly track dead nodes that are on the original SDNode's operand list but not the new one, and have no other uses. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53201 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen')
-rw-r--r--include/llvm/CodeGen/SelectionDAG.h5
-rw-r--r--include/llvm/CodeGen/SelectionDAGNodes.h8
2 files changed, 12 insertions, 1 deletions
diff --git a/include/llvm/CodeGen/SelectionDAG.h b/include/llvm/CodeGen/SelectionDAG.h
index 6568d90951..56bd40ae5c 100644
--- a/include/llvm/CodeGen/SelectionDAG.h
+++ b/include/llvm/CodeGen/SelectionDAG.h
@@ -537,6 +537,11 @@ public:
/// for each node deleted.
void RemoveDeadNode(SDNode *N, DAGUpdateListener *UpdateListener = 0);
+ /// RemoveDeadNodes - This method deletes the unreachable nodes in the
+ /// given list, and any nodes that become unreachable as a result.
+ void RemoveDeadNodes(SmallVectorImpl<SDNode *> &DeadNodes,
+ DAGUpdateListener *UpdateListener = 0);
+
/// ReplaceAllUsesWith - Modify anything using 'From' to use 'To' instead.
/// This can cause recursive merging of nodes in the DAG. Use the first
/// version if 'From' is known to have a single result, use the second
diff --git a/include/llvm/CodeGen/SelectionDAGNodes.h b/include/llvm/CodeGen/SelectionDAGNodes.h
index f5ab0707c4..fe1cab6fe6 100644
--- a/include/llvm/CodeGen/SelectionDAGNodes.h
+++ b/include/llvm/CodeGen/SelectionDAGNodes.h
@@ -1315,12 +1315,18 @@ protected:
++Ops[i].getVal()->UsesSize;
}
}
+
+ /// DropOperands - Release the operands and set this node to have
+ /// zero operands. This should only be used by HandleSDNode to clear
+ /// its operand list.
+ void DropOperands();
/// MorphNodeTo - This frees the operands of the current node, resets the
/// opcode, types, and operands to the specified value. This should only be
/// used by the SelectionDAG class.
void MorphNodeTo(unsigned Opc, SDVTList L,
- const SDOperand *Ops, unsigned NumOps);
+ const SDOperand *Ops, unsigned NumOps,
+ SmallVectorImpl<SDNode *> &DeadNodes);
void addUser(unsigned i, SDNode *User) {
assert(User->OperandList[i].getUser() && "Node without parent");