<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Ah, I think that's the difference.  Statepoint's MMOs are
      referencing stack objects and I hadn't consider that was possible
      special.  Oh well.</p>
    <p>Philip<br>
    </p>
    <div class="moz-cite-prefix">On 3/18/20 5:41 PM, Craig Topper wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAF7ks-N+QK_yRwBLe7Oy-L=rx7tH5wDL4oV=v3HHFcn9zdcOVw@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">Isn't what's stored in the PointerInfo of a MMO
        usually a Value * from IR? Except when its a stack reference or
        a constant pool or one of the other PseudoSources?
        <div><br clear="all">
          <div>
            <div dir="ltr" class="gmail_signature"
              data-smartmail="gmail_signature">~Craig</div>
          </div>
          <br>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Wed, Mar 18, 2020 at 5:32
          PM Philip Reames <<a
            href="mailto:listmail@philipreames.com"
            moz-do-not-send="true">listmail@philipreames.com</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div>
            <p>I wasn't talking about the IR representation at all.  At
              MC, we can provide multiple MMO on a single instruction. 
              Given the semantics of a gather, we could encode each
              implied memory access separate with it's own {base,
              offset} information.  So a single gather instruction would
              have MMOs: {base, offset1}, {base, offset2}, ....</p>
            <p>I hadn't considered the SDAG representation.  We handle
              that for STATEPOINT (one user of multiple MMOs I happen to
              be familiar with) by placing them directly on a target
              specific STATEPOINT node.  So, yes, we'd probably want to
              either allow MemSDNode to have multiple MMOs or split the
              usage.</p>
            <p>Philip<br>
            </p>
            <div>On 3/18/20 4:28 PM, Craig Topper wrote:<br>
            </div>
            <blockquote type="cite">
              <div dir="ltr">
                <div>There's probably something we can do there. We'd
                  need a scalar pointer in IR to refer to though right?
                  We likely have a vector GEP and none of the underlying
                  APIs know what to do with that. Or we need to change
                  those APIs to refer to a specific element of the
                  vector?</div>
                <div><br>
                </div>
                <div>We'd also need a new base class for the gather and
                  scatter nodes in SelectionDAG other than MemSDNode or
                  we'd need to change MemSDNode to have more than just a
                  single MemOperand pointer.</div>
                <br clear="all">
                <div>
                  <div dir="ltr">~Craig</div>
                </div>
                <br>
              </div>
              <br>
              <div class="gmail_quote">
                <div dir="ltr" class="gmail_attr">On Wed, Mar 18, 2020
                  at 4:16 PM Philip Reames via llvm-commits <<a
                    href="mailto:llvm-commits@lists.llvm.org"
                    target="_blank" moz-do-not-send="true">llvm-commits@lists.llvm.org</a>>
                  wrote:<br>
                </div>
                <blockquote class="gmail_quote" style="margin:0px 0px
                  0px 0.8ex;border-left:1px solid
                  rgb(204,204,204);padding-left:1ex">Just curious, we
                  have the ability to describe multiple memory locations
                  <br>
                  for a single instruction.  Why not simply track each
                  lane independently <br>
                  and keep the right locations on each half?<br>
                  <br>
                  Philip<br>
                  <br>
                  On 3/18/20 4:12 PM, Craig Topper via llvm-commits
                  wrote:<br>
                  > Author: Craig Topper<br>
                  > Date: 2020-03-18T16:07:15-07:00<br>
                  > New Revision:
                  c69a4d6bef0a1350f509f35beb450dccc2a6c5e2<br>
                  ><br>
                  > URL: <a
href="https://github.com/llvm/llvm-project/commit/c69a4d6bef0a1350f509f35beb450dccc2a6c5e2"
                    rel="noreferrer" target="_blank"
                    moz-do-not-send="true">https://github.com/llvm/llvm-project/commit/c69a4d6bef0a1350f509f35beb450dccc2a6c5e2</a><br>
                  > DIFF: <a
href="https://github.com/llvm/llvm-project/commit/c69a4d6bef0a1350f509f35beb450dccc2a6c5e2.diff"
                    rel="noreferrer" target="_blank"
                    moz-do-not-send="true">https://github.com/llvm/llvm-project/commit/c69a4d6bef0a1350f509f35beb450dccc2a6c5e2.diff</a><br>
                  ><br>
                  > LOG: [SelectionDAG] When splitting
                  gathers/scatters in type legalization, set MMO size to
                  UnknownSize<br>
                  ><br>
                  > Gather/scatter don't access one memory location,
                  they access multiple disjoint locations. So using a
                  fixed size isn't accurate. But we don't have a way to
                  represent the true behavior so just use UnknownSize.<br>
                  ><br>
                  > Previously we "split" the memory VT and use that
                  size for the MMO of each half. But the memory VT is
                  scalar so splitting usually just returned the original
                  scalar VT, but on 32-bit X86 if the scalar VT was i64
                  it probably returned i32?<br>
                  ><br>
                  > Differential Revision: <a
                    href="https://reviews.llvm.org/D76388"
                    rel="noreferrer" target="_blank"
                    moz-do-not-send="true">https://reviews.llvm.org/D76388</a><br>
                  ><br>
                  > Added:<br>
                  >      <br>
                  ><br>
                  > Modified:<br>
                  >     
                  llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp<br>
                  ><br>
                  > Removed:<br>
                  >      <br>
                  ><br>
                  ><br>
                  >
################################################################################<br>
                  > diff  --git
                  a/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
b/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp<br>
                  > index 5a4b4c615bc0..09934bbb29fe 100644<br>
                  > ---
                  a/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp<br>
                  > +++
                  b/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp<br>
                  > @@ -20,10 +20,11 @@<br>
                  > 
 //===----------------------------------------------------------------------===//<br>
                  >   <br>
                  >   #include "LegalizeTypes.h"<br>
                  > +#include "llvm/Analysis/MemoryLocation.h"<br>
                  >   #include "llvm/IR/DataLayout.h"<br>
                  >   #include "llvm/Support/ErrorHandling.h"<br>
                  > -#include "llvm/Support/raw_ostream.h"<br>
                  >   #include "llvm/Support/TypeSize.h"<br>
                  > +#include "llvm/Support/raw_ostream.h"<br>
                  >   using namespace llvm;<br>
                  >   <br>
                  >   #define DEBUG_TYPE "legalize-types"<br>
                  > @@ -1627,11 +1628,6 @@ void
                  DAGTypeLegalizer::SplitVecRes_MGATHER(MaskedGatherSDNode
                  *MGT,<br>
                  >         std::tie(MaskLo, MaskHi) =
                  DAG.SplitVector(Mask, dl);<br>
                  >     }<br>
                  >   <br>
                  > -  EVT MemoryVT = MGT->getMemoryVT();<br>
                  > -  EVT LoMemVT, HiMemVT;<br>
                  > -  // Split MemoryVT<br>
                  > -  std::tie(LoMemVT, HiMemVT) =
                  DAG.GetSplitDestVTs(MemoryVT);<br>
                  > -<br>
                  >     SDValue PassThruLo, PassThruHi;<br>
                  >     if (getTypeAction(PassThru.getValueType()) ==
                  TargetLowering::TypeSplitVector)<br>
                  >       GetSplitVector(PassThru, PassThruLo,
                  PassThruHi);<br>
                  > @@ -1644,10 +1640,10 @@ void
                  DAGTypeLegalizer::SplitVecRes_MGATHER(MaskedGatherSDNode
                  *MGT,<br>
                  >     else<br>
                  >       std::tie(IndexLo, IndexHi) =
                  DAG.SplitVector(Index, dl);<br>
                  >   <br>
                  > -  MachineMemOperand *MMO =
                  DAG.getMachineFunction().<br>
                  > -   
                  getMachineMemOperand(MGT->getPointerInfo(),<br>
                  > -                       
                   MachineMemOperand::MOLoad,  LoMemVT.getStoreSize(),<br>
                  > -                         Alignment,
                  MGT->getAAInfo(), MGT->getRanges());<br>
                  > +  MachineMemOperand *MMO =
                  DAG.getMachineFunction().getMachineMemOperand(<br>
                  > +      MGT->getPointerInfo(),
                  MachineMemOperand::MOLoad,<br>
                  > +      MemoryLocation::UnknownSize, Alignment,
                  MGT->getAAInfo(),<br>
                  > +      MGT->getRanges());<br>
                  >   <br>
                  >     SDValue OpsLo[] = {Ch, PassThruLo, MaskLo,
                  Ptr, IndexLo, Scale};<br>
                  >     Lo = DAG.getMaskedGather(DAG.getVTList(LoVT,
                  MVT::Other), LoVT, dl, OpsLo,<br>
                  > @@ -2376,13 +2372,10 @@ SDValue
                  DAGTypeLegalizer::SplitVecOp_MSCATTER(MaskedScatterSDNode
                  *N,<br>
                  >     SDValue Index = N->getIndex();<br>
                  >     SDValue Scale = N->getScale();<br>
                  >     SDValue Data = N->getValue();<br>
                  > -  EVT MemoryVT = N->getMemoryVT();<br>
                  >     unsigned Alignment =
                  N->getOriginalAlignment();<br>
                  >     SDLoc DL(N);<br>
                  >   <br>
                  >     // Split all operands<br>
                  > -  EVT LoMemVT, HiMemVT;<br>
                  > -  std::tie(LoMemVT, HiMemVT) =
                  DAG.GetSplitDestVTs(MemoryVT);<br>
                  >   <br>
                  >     SDValue DataLo, DataHi;<br>
                  >     if (getTypeAction(Data.getValueType()) ==
                  TargetLowering::TypeSplitVector)<br>
                  > @@ -2409,20 +2402,14 @@ SDValue
                  DAGTypeLegalizer::SplitVecOp_MSCATTER(MaskedScatterSDNode
                  *N,<br>
                  >       std::tie(IndexLo, IndexHi) =
                  DAG.SplitVector(Index, DL);<br>
                  >   <br>
                  >     SDValue Lo;<br>
                  > -  MachineMemOperand *MMO =
                  DAG.getMachineFunction().<br>
                  > -    getMachineMemOperand(N->getPointerInfo(),<br>
                  > -                       
                   MachineMemOperand::MOStore, LoMemVT.getStoreSize(),<br>
                  > -                         Alignment,
                  N->getAAInfo(), N->getRanges());<br>
                  > +  MachineMemOperand *MMO =
                  DAG.getMachineFunction().getMachineMemOperand(<br>
                  > +      N->getPointerInfo(),
                  MachineMemOperand::MOStore,<br>
                  > +      MemoryLocation::UnknownSize, Alignment,
                  N->getAAInfo(), N->getRanges());<br>
                  >   <br>
                  >     SDValue OpsLo[] = {Ch, DataLo, MaskLo, Ptr,
                  IndexLo, Scale};<br>
                  >     Lo =
                  DAG.getMaskedScatter(DAG.getVTList(MVT::Other),
                  DataLo.getValueType(),<br>
                  >                               DL, OpsLo, MMO,
                  N->getIndexType());<br>
                  >   <br>
                  > -  MMO = DAG.getMachineFunction().<br>
                  > -    getMachineMemOperand(N->getPointerInfo(),<br>
                  > -                       
                   MachineMemOperand::MOStore,  HiMemVT.getStoreSize(),<br>
                  > -                         Alignment,
                  N->getAAInfo(), N->getRanges());<br>
                  > -<br>
                  >     // The order of the Scatter operation after
                  split is well defined. The "Hi"<br>
                  >     // part comes after the "Lo". So these two
                  operations should be chained one<br>
                  >     // after another.<br>
                  ><br>
                  ><br>
                  >          <br>
                  > _______________________________________________<br>
                  > llvm-commits mailing list<br>
                  > <a href="mailto:llvm-commits@lists.llvm.org"
                    target="_blank" moz-do-not-send="true">llvm-commits@lists.llvm.org</a><br>
                  > <a
                    href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits"
                    rel="noreferrer" target="_blank"
                    moz-do-not-send="true">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
                  _______________________________________________<br>
                  llvm-commits mailing list<br>
                  <a href="mailto:llvm-commits@lists.llvm.org"
                    target="_blank" moz-do-not-send="true">llvm-commits@lists.llvm.org</a><br>
                  <a
                    href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits"
                    rel="noreferrer" target="_blank"
                    moz-do-not-send="true">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
                </blockquote>
              </div>
            </blockquote>
          </div>
        </blockquote>
      </div>
    </blockquote>
  </body>
</html>