Author: lattner Date: Wed Feb 13 01:25:05 2008 New Revision: 47052 URL: http://llvm.org/viewvc/llvm-project?rev=47052&view=rev Log: teach dag combiner how to eliminate MERGE_VALUES nodes.
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=47052&r1=47051&r2=47052&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Wed Feb 13 01:25:05 2008 @@ -137,6 +137,7 @@ // 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 @@ 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 @@ 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(); _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits