This step is just intended to reduce code duplication rather than change any functionality.
However, I noticed that PowerPC has PPCTargetLowering::spliceIntoChain(), and it seems to do almost the same thing as the x86 code. My understanding of this still isn't good, so it's not clear to me if the x86 code is overkill or if the PPC version is not going far enough. At the least, the code comment for spliceIntoChain() doesn't match the code itself: we don't actually add the old chain to the TokenFactor there?
Pasting the PPC code here for reference:
// Given the head of the old chain, ResChain, insert a token factor containing // it and NewResChain, and make users of ResChain now be users of that token // factor. void PPCTargetLowering::spliceIntoChain(SDValue ResChain, SDValue NewResChain, SelectionDAG &DAG) const { if (!ResChain) return; SDLoc dl(NewResChain); SDValue TF = DAG.getNode(ISD::TokenFactor, dl, MVT::Other, NewResChain, DAG.getUNDEF(MVT::Other)); assert(TF.getNode() != NewResChain.getNode() && "A new TF really is required here"); DAG.ReplaceAllUsesOfValueWith(ResChain, TF); DAG.UpdateNodeOperands(TF.getNode(), ResChain, NewResChain); }
It'd be nice if the name bindChain could probably be clearer. Maybe something along the lines of "markSymettricMemoryOrderings".