Index: DAGCombiner.cpp =================================================================== --- DAGCombiner.cpp (revision 67516) +++ DAGCombiner.cpp (working copy) @@ -782,13 +782,8 @@ } SDValue DAGCombiner::combine(SDNode *N) { - SDValue RV = visit(N); - // If nothing happened, try a target-specific DAG combine. - if (RV.getNode() == 0) { - assert(N->getOpcode() != ISD::DELETED_NODE && - "Node was deleted but visit returned NULL!"); - + // First allow target to do its own stuff. if (N->getOpcode() >= ISD::BUILTIN_OP_END || TLI.hasTargetDAGCombine((ISD::NodeType)N->getOpcode())) { @@ -798,6 +793,12 @@ RV = TLI.PerformDAGCombine(N, DagCombineInfo); } + + // If nothing happened, try generic DAG combine. + if (RV.getNode() == 0) { + assert(N->getOpcode() != ISD::DELETED_NODE && + "Node was deleted but target combine returned NULL!"); + SDValue RV = visit(N); } // If N is a commutative binary node, try commuting it to enable more