Don't auto-cse nodes that return flags

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23055 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2005-08-25 19:12:10 +00:00
parent 8064e8fbf4
commit 43247a157b

View File

@@ -1021,9 +1021,14 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT,
break; break;
} }
SDNode *&N = UnaryOps[std::make_pair(Opcode, std::make_pair(Operand, VT))]; SDNode *N;
if (N) return SDOperand(N, 0); if (VT != MVT::Flag) { // Don't CSE flag producing nodes
N = new SDNode(Opcode, Operand); SDNode *&E = UnaryOps[std::make_pair(Opcode, std::make_pair(Operand, VT))];
if (E) return SDOperand(N, 0);
E = N = new SDNode(Opcode, Operand);
} else {
N = new SDNode(Opcode, Operand);
}
N->setValueTypes(VT); N->setValueTypes(VT);
AllNodes.push_back(N); AllNodes.push_back(N);
return SDOperand(N, 0); return SDOperand(N, 0);
@@ -1582,7 +1587,8 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT,
// Memoize this node if possible. // Memoize this node if possible.
SDNode *N; SDNode *N;
if (Opcode != ISD::CALLSEQ_START && Opcode != ISD::CALLSEQ_END) { if (Opcode != ISD::CALLSEQ_START && Opcode != ISD::CALLSEQ_END &&
VT != MVT::Flag) {
SDNode *&BON = BinaryOps[std::make_pair(Opcode, std::make_pair(N1, N2))]; SDNode *&BON = BinaryOps[std::make_pair(Opcode, std::make_pair(N1, N2))];
if (BON) return SDOperand(BON, 0); if (BON) return SDOperand(BON, 0);
@@ -1704,11 +1710,15 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT,
Ops.push_back(N2); Ops.push_back(N2);
Ops.push_back(N3); Ops.push_back(N3);
// Memoize nodes. // Memoize node if it doesn't produce a flag.
SDNode *&N = OneResultNodes[std::make_pair(Opcode, std::make_pair(VT, Ops))]; SDNode *N;
if (N) return SDOperand(N, 0); if (VT != MVT::Flag) {
SDNode *&E = OneResultNodes[std::make_pair(Opcode,std::make_pair(VT, Ops))];
N = new SDNode(Opcode, N1, N2, N3); if (E) return SDOperand(E, 0);
E = N = new SDNode(Opcode, N1, N2, N3);
} else {
N = new SDNode(Opcode, N1, N2, N3);
}
N->setValueTypes(VT); N->setValueTypes(VT);
AllNodes.push_back(N); AllNodes.push_back(N);
return SDOperand(N, 0); return SDOperand(N, 0);
@@ -1833,9 +1843,15 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT,
} }
// Memoize nodes. // Memoize nodes.
SDNode *&N = OneResultNodes[std::make_pair(Opcode, std::make_pair(VT, Ops))]; SDNode *N;
if (N) return SDOperand(N, 0); if (VT != MVT::Flag) {
N = new SDNode(Opcode, Ops); SDNode *&E =
OneResultNodes[std::make_pair(Opcode, std::make_pair(VT, Ops))];
if (E) return SDOperand(E, 0);
E = N = new SDNode(Opcode, Ops);
} else {
N = new SDNode(Opcode, Ops);
}
N->setValueTypes(VT); N->setValueTypes(VT);
AllNodes.push_back(N); AllNodes.push_back(N);
return SDOperand(N, 0); return SDOperand(N, 0);
@@ -1888,11 +1904,16 @@ SDOperand SelectionDAG::getNode(unsigned Opcode,
#endif #endif
} }
// Memoize the node. // Memoize the node unless it returns a flag.
SDNode *&N = ArbitraryNodes[std::make_pair(Opcode, std::make_pair(ResultTys, SDNode *N;
Ops))]; if (ResultTys.back() != MVT::Flag) {
if (N) return SDOperand(N, 0); SDNode *&E =
N = new SDNode(Opcode, Ops); ArbitraryNodes[std::make_pair(Opcode, std::make_pair(ResultTys, Ops))];
if (E) return SDOperand(E, 0);
E = N = new SDNode(Opcode, Ops);
} else {
N = new SDNode(Opcode, Ops);
}
N->setValueTypes(ResultTys); N->setValueTypes(ResultTys);
AllNodes.push_back(N); AllNodes.push_back(N);
return SDOperand(N, 0); return SDOperand(N, 0);