Handle the trivial (but common) two-op case more efficiently

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24259 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2005-11-09 18:48:57 +00:00
parent e6a88ac1b9
commit 040c11c24e

View File

@ -633,10 +633,17 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
}
break;
}
case ISD::TokenFactor: {
case ISD::TokenFactor:
if (Node->getNumOperands() == 2) {
bool Changed = false;
SDOperand Op0 = LegalizeOp(Node->getOperand(0));
SDOperand Op1 = LegalizeOp(Node->getOperand(1));
if (Op0 != Node->getOperand(0) || Op1 != Node->getOperand(1))
Result = DAG.getNode(ISD::TokenFactor, MVT::Other, Op0, Op1);
} else {
std::vector<SDOperand> Ops;
bool Changed = false;
// Legalize the operands
// Legalize the operands.
for (unsigned i = 0, e = Node->getNumOperands(); i != e; ++i) {
SDOperand Op = Node->getOperand(i);
Ops.push_back(LegalizeOp(Op));
@ -644,8 +651,8 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
}
if (Changed)
Result = DAG.getNode(ISD::TokenFactor, MVT::Other, Ops);
break;
}
break;
case ISD::CALLSEQ_START:
case ISD::CALLSEQ_END: