memoize all nodes, even null Value* nodes. Do not add two token chain outputs
authorChris Lattner <sabre@nondot.org>
Mon, 9 May 2005 04:14:13 +0000 (04:14 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 9 May 2005 04:14:13 +0000 (04:14 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21805 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/SelectionDAG.cpp

index 965976cce3d0c6718032d4a58fc9b37eed78bf1b..c9ce79622007e1cd36bf64d746dabdd330a9f9fe 100644 (file)
@@ -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);
 }