Don't remove two operand, two result nodes from the binary ops map. These

should come from the arbitrary ops map.

This fixes Regression/CodeGen/PowerPC/2005-12-01-Crash.ll

llvm-svn: 24571
This commit is contained in:
Chris Lattner 2005-12-01 23:14:50 +00:00
parent e4ffb9a57d
commit 0142afd6c1
1 changed files with 39 additions and 36 deletions

View File

@ -388,43 +388,46 @@ void SelectionDAG::RemoveNodeFromCSEMaps(SDNode *N) {
SDNode *SelectionDAG::AddNonLeafNodeToCSEMaps(SDNode *N) { SDNode *SelectionDAG::AddNonLeafNodeToCSEMaps(SDNode *N) {
assert(N->getNumOperands() && "This is a leaf node!"); assert(N->getNumOperands() && "This is a leaf node!");
if (N->getOpcode() == ISD::CALLSEQ_START || if (N->getOpcode() == ISD::CALLSEQ_START ||
N->getOpcode() == ISD::CALLSEQ_END) N->getOpcode() == ISD::CALLSEQ_END ||
return 0; N->getOpcode() == ISD::HANDLENODE)
return 0; // Never add these nodes.
if (N->getOpcode() == ISD::LOAD) { if (N->getNumValues() == 1) {
SDNode *&L = Loads[std::make_pair(N->getOperand(1), if (N->getNumOperands() == 1) {
std::make_pair(N->getOperand(0), SDNode *&U = UnaryOps[std::make_pair(N->getOpcode(),
N->getValueType(0)))]; std::make_pair(N->getOperand(0),
if (L) return L; N->getValueType(0)))];
L = N; if (U) return U;
} else if (N->getOpcode() == ISD::HANDLENODE) { U = N;
return 0; // never add it. } else if (N->getNumOperands() == 2) {
} else if (N->getNumOperands() == 1) { SDNode *&B = BinaryOps[std::make_pair(N->getOpcode(),
SDNode *&U = UnaryOps[std::make_pair(N->getOpcode(), std::make_pair(N->getOperand(0),
std::make_pair(N->getOperand(0), N->getOperand(1)))];
N->getValueType(0)))]; if (B) return B;
if (U) return U; B = N;
U = N; } else {
} else if (N->getNumOperands() == 2) { std::vector<SDOperand> Ops(N->op_begin(), N->op_end());
SDNode *&B = BinaryOps[std::make_pair(N->getOpcode(), SDNode *&ORN = OneResultNodes[std::make_pair(N->getOpcode(),
std::make_pair(N->getOperand(0), std::make_pair(N->getValueType(0), Ops))];
N->getOperand(1)))]; if (ORN) return ORN;
if (B) return B; ORN = N;
B = N; }
} else if (N->getNumValues() == 1) { } else {
std::vector<SDOperand> Ops(N->op_begin(), N->op_end()); if (N->getOpcode() == ISD::LOAD) {
SDNode *&ORN = OneResultNodes[std::make_pair(N->getOpcode(), SDNode *&L = Loads[std::make_pair(N->getOperand(1),
std::make_pair(N->getValueType(0), Ops))]; std::make_pair(N->getOperand(0),
if (ORN) return ORN; N->getValueType(0)))];
ORN = N; if (L) return L;
} else { L = N;
// Remove the node from the ArbitraryNodes map. } else {
std::vector<MVT::ValueType> RV(N->value_begin(), N->value_end()); // Remove the node from the ArbitraryNodes map.
std::vector<SDOperand> Ops(N->op_begin(), N->op_end()); std::vector<MVT::ValueType> RV(N->value_begin(), N->value_end());
SDNode *&AN = ArbitraryNodes[std::make_pair(N->getOpcode(), std::vector<SDOperand> Ops(N->op_begin(), N->op_end());
std::make_pair(RV, Ops))]; SDNode *&AN = ArbitraryNodes[std::make_pair(N->getOpcode(),
if (AN) return AN; std::make_pair(RV, Ops))];
AN = N; if (AN) return AN;
AN = N;
}
} }
return 0; return 0;
} }