diff options
author | Chris Lattner <sabre@nondot.org> | 2008-02-13 07:25:05 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-02-13 07:25:05 +0000 |
commit | fec42eb6daff7e8b644bd24cbf12f83d6b14bd8b (patch) | |
tree | 14d8133b2aee3f935d2de8c07911b56ee43f47bb /lib/CodeGen | |
parent | b5041b30851b1173170a8d281b2e9571a2a04bdd (diff) |
teach dag combiner how to eliminate MERGE_VALUES nodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47052 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index a2f36f33b4..29a31e4e1d 100644 --- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -137,6 +137,7 @@ namespace { // otherwise - N should be replaced by the returned Operand. // SDOperand visitTokenFactor(SDNode *N); + SDOperand visitMERGE_VALUES(SDNode *N); SDOperand visitADD(SDNode *N); SDOperand visitSUB(SDNode *N); SDOperand visitADDC(SDNode *N); @@ -662,6 +663,7 @@ SDOperand DAGCombiner::visit(SDNode *N) { switch(N->getOpcode()) { default: break; case ISD::TokenFactor: return visitTokenFactor(N); + case ISD::MERGE_VALUES: return visitMERGE_VALUES(N); case ISD::ADD: return visitADD(N); case ISD::SUB: return visitSUB(N); case ISD::ADDC: return visitADDC(N); @@ -837,6 +839,18 @@ SDOperand DAGCombiner::visitTokenFactor(SDNode *N) { return Result; } +/// MERGE_VALUES can always be eliminated. +SDOperand DAGCombiner::visitMERGE_VALUES(SDNode *N) { + WorkListRemover DeadNodes(*this); + for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) + DAG.ReplaceAllUsesOfValueWith(SDOperand(N, i), N->getOperand(i), + &DeadNodes); + removeFromWorkList(N); + DAG.DeleteNode(N); + return SDOperand(N, 0); // Return N so it doesn't get rechecked! +} + + static SDOperand combineShlAddConstant(SDOperand N0, SDOperand N1, SelectionDAG &DAG) { MVT::ValueType VT = N0.getValueType(); |