diff options
author | Chris Lattner <sabre@nondot.org> | 2005-05-09 04:14:13 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-05-09 04:14:13 +0000 |
commit | 0437cdd6dc204a77854a61bf19f33cd272224d10 (patch) | |
tree | 9cf79e323e8b7962914ca4856a2bd557e30dc4ce /lib/CodeGen/SelectionDAG/SelectionDAG.cpp | |
parent | 369e6db9b6033bb60519b0ad84afeacc9ec9b416 (diff) |
memoize all nodes, even null Value* nodes. Do not add two token chain outputs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21805 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 965976cce3..c9ce796220 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -1328,13 +1328,11 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT, return SDOperand(N, 0); } -SDOperand SelectionDAG::getSrcValue(const Value* v, int offset) { - if (v && ValueNodes[std::make_pair(v,offset)]) - return SDOperand(ValueNodes[std::make_pair(v,offset)], 0); - SDNode *N = new SrcValueSDNode(v, offset); - N->setValueTypes(MVT::Other); - if (v) //only track non-null values - ValueNodes[std::make_pair(v,offset)] = N; +SDOperand SelectionDAG::getSrcValue(const Value *V, int Offset) { + SDNode *&N = ValueNodes[std::make_pair(V, Offset)]; + if (N) return SDOperand(N, 0); + + N = new SrcValueSDNode(V, Offset); AllNodes.push_back(N); return SDOperand(N, 0); } |