Index: lib/CodeGen/SelectionDAG/DAGCombiner.cpp =================================================================== --- lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -14777,6 +14777,11 @@ SmallVector, 8> BetterChains; for (StoreSDNode *ChainedStore : ChainedStores) { + // If ChainedStore has more than one value, we don't try replaceStoreChain. + // replaceStoreChain uses CombineTo, which only consider Chain only. + if (ChainedStore->getNumValues() != 1) + continue; + SDValue Chain = ChainedStore->getChain(); SDValue BetterChain = FindBetterChain(ChainedStore, Chain);