diff options
| author | Chris Lattner <sabre@nondot.org> | 2005-09-02 19:36:17 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2005-09-02 19:36:17 +0000 |
| commit | b95b280bee96232769a00a314b450bbe44fcde62 (patch) | |
| tree | 513e2520df06ce69e2903385df38d04f4f9fcd5a /llvm/lib/CodeGen | |
| parent | 5ba7b615edb4564e530a7133fa2e01554fa93639 (diff) | |
| download | bcm5719-llvm-b95b280bee96232769a00a314b450bbe44fcde62.tar.gz bcm5719-llvm-b95b280bee96232769a00a314b450bbe44fcde62.zip | |
Make sure to auto-cse nullary ops
llvm-svn: 23224
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index cf4700eb22f..bf9482587dc 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -326,7 +326,10 @@ void SelectionDAG::RemoveNodeFromCSEMaps(SDNode *N) { break; default: if (N->getNumValues() == 1) { - if (N->getNumOperands() == 1) { + if (N->getNumOperands() == 0) { + Erased = NullaryOps.erase(std::make_pair(N->getOpcode(), + N->getValueType(0))); + } else if (N->getNumOperands() == 1) { Erased = UnaryOps.erase(std::make_pair(N->getOpcode(), std::make_pair(N->getOperand(0), @@ -1010,8 +1013,11 @@ SDOperand SelectionDAG::SimplifySelectCC(SDOperand N1, SDOperand N2, /// getNode - Gets or creates the specified node. /// SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT) { - SDNode *N = new SDNode(Opcode, VT); - AllNodes.push_back(N); + SDNode *&N = NullaryOps[std::make_pair(Opcode, VT)]; + if (!N) { + N = new SDNode(Opcode, VT); + AllNodes.push_back(N); + } return SDOperand(N, 0); } |

