diff options
-rw-r--r-- | include/llvm/CodeGen/SelectionDAGNodes.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/include/llvm/CodeGen/SelectionDAGNodes.h b/include/llvm/CodeGen/SelectionDAGNodes.h index 00b94037ad..930a163848 100644 --- a/include/llvm/CodeGen/SelectionDAGNodes.h +++ b/include/llvm/CodeGen/SelectionDAGNodes.h @@ -614,7 +614,14 @@ protected: void MorphNodeTo(unsigned Opc) { NodeType = Opc; Values.clear(); - Operands.clear(); + + // Clear the operands list, updating used nodes to remove this from their + // use list. + while (!Operands.empty()) { + SDNode *O = Operands.back().Val; + Operands.pop_back(); + O->removeUser(this); + } } void setValueTypes(MVT::ValueType VT) { |