Index: lib/CodeGen/SelectionDAG/DAGCombiner.cpp =================================================================== --- lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -11738,8 +11738,27 @@ // Make sure the new and old chains are cleaned up. AddToWorklist(Token.getNode()); + // Inlined CombineTo to handle store with pre/post-inc. // Don't add users to work list. - return CombineTo(ST, Token, false); + unsigned Index = (ST->getNumValues() > 1) ? 1 : 0; // Chain. + ++NodesCombined; + DEBUG(dbgs() << "\nReplacing.1 "; + ST->dump(&DAG); + dbgs() << "\nWith: "; + Token.getNode()->dump(&DAG)); + assert((!Token.getNode() || + ST->getValueType(Index) == Token.getValueType()) && + "Cannot combine value to value of different type!"); + + WorklistRemover DeadNodes(*this); + DAG.ReplaceAllUsesOfValueWith(SDValue(ST, Index), Token); + + // Finally, if the node is now dead, remove it from the graph. The node + // may not be dead if the replacement process recursively simplified to + // something else needing this node. + if (ST->use_empty()) + deleteAndRecombine(ST); + return SDValue(ST, 0); } SDValue DAGCombiner::replaceStoreOfFPConstant(StoreSDNode *ST) {