[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Chris Lattner
lattner at cs.uiuc.edu
Wed Nov 9 10:49:08 PST 2005
Changes in directory llvm/lib/CodeGen/SelectionDAG:
LegalizeDAG.cpp updated: 1.204 -> 1.205
---
Log message:
Handle the trivial (but common) two-op case more efficiently
---
Diffs of the changes: (+18 -11)
LegalizeDAG.cpp | 29 ++++++++++++++++++-----------
1 files changed, 18 insertions(+), 11 deletions(-)
Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.204 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.205
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.204 Tue Nov 8 17:32:44 2005
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Nov 9 12:48:57 2005
@@ -633,19 +633,26 @@
}
break;
}
- case ISD::TokenFactor: {
- std::vector<SDOperand> Ops;
- bool Changed = false;
- // Legalize the operands
- for (unsigned i = 0, e = Node->getNumOperands(); i != e; ++i) {
- SDOperand Op = Node->getOperand(i);
- Ops.push_back(LegalizeOp(Op));
- Changed |= Ops[i] != Op;
+ 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.
+ for (unsigned i = 0, e = Node->getNumOperands(); i != e; ++i) {
+ SDOperand Op = Node->getOperand(i);
+ Ops.push_back(LegalizeOp(Op));
+ Changed |= Ops[i] != Op;
+ }
+ if (Changed)
+ Result = DAG.getNode(ISD::TokenFactor, MVT::Other, Ops);
}
- if (Changed)
- Result = DAG.getNode(ISD::TokenFactor, MVT::Other, Ops);
break;
- }
case ISD::CALLSEQ_START:
case ISD::CALLSEQ_END:
More information about the llvm-commits
mailing list