[PATCH] D33649: [DAG] add helper to bind memop chains; NFCI

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 29 06:52:34 PDT 2017


spatel created this revision.
Herald added a subscriber: mcrosier.

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);
  }


https://reviews.llvm.org/D33649

Files:
  include/llvm/CodeGen/SelectionDAG.h
  lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  lib/CodeGen/SelectionDAG/SelectionDAG.cpp
  lib/Target/X86/X86ISelLowering.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33649.100610.patch
Type: text/x-patch
Size: 6153 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170529/3ae5bc72/attachment.bin>


More information about the llvm-commits mailing list