<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 07/16/2017 03:27 PM, Daniel Berlin
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAF4BwTWH6cYCqKNo4LpH3o+-YxcL-=vSK2ZQ=PXJNkNNq0KnLg@mail.gmail.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <br>
      <br>
      <div class="gmail_quote">
        <div dir="ltr">On Sun, Jul 16, 2017, 12:45 PM Nuno Lopes <<a
            moz-do-not-send="true" href="mailto:nunoplopes@sapo.pt">nunoplopes@sapo.pt</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">>On
          07/15/2017 04:51 AM, Nuno Lopes wrote:<br>
          >>> On 07/14/2017 04:37 PM, Nuno Lopes wrote:<br>
          >>>> Thank you all for your replies.<br>
          >>>> So here seems to be an agreement that the
          documentation for<br>
          >>>> PartialAlias is incorrect.<br>
          >>>><br>
          >>>> Daniel: now you got me wondering about
          MustAlias. This is what the<br>
          >>>> docs say:<br>
          >>>> "The MustAlias response may only be returned
          if the two memory<br>
          >>>> objects are *guaranteed to always start at
          exactly the same location*"<br>
          >>>><br>
          >>>> This statement is regardless of the access
          sizes.  For example, in<br>
          >>>> SCEV AA:<br>
          >>>> // If they evaluate to the same expression,
          it's a MustAlias.<br>
          >>>> if (AS == BS)<br>
          >>>>  return MustAlias;<br>
          >>>><br>
          >>>> AS/BS are scev expressions for the pointers.
          So no check for the<br>
          >>>> access size.<br>
          >>>><br>
          >>>> So, does must needs to check for access
          sizes?  If so, SCEV AA is<br>
          >>>> buggy and the documentation needs tweaking.<br>
          >>><br>
          >>> I'm under the impression that there is code that
          depends on the size<br>
          >>> check, but I don't trust my recollection in this
          regard. SCEV AA is<br>
          >>> known to cause miscompiles, IIRC, maybe you just
          found out why ;)<br>
          >><br>
          >> It's true that the CFL AAs have this code:<br>
          >> if (LocA.Ptr == LocB.Ptr)<br>
          >>  return LocA.Size == LocB.Size ? MustAlias :
          PartialAlias;<br>
          >><br>
          >><br>
          >> I grepped for clients of MustAlias:<br>
          >> ~/llvm/lib/Transforms $ grep -Rl MustAlias .<br>
          >> ./ObjCARC/ObjCARCOpts.cpp<br>
          >> ./ObjCARC/ProvenanceAnalysis.cpp<br>
          >> ./Scalar/DeadStoreElimination.cpp<br>
          >> ./Scalar/GVN.cpp<br>
          >> ./Scalar/LICM.cpp<br>
          >> ./Scalar/LoopVersioningLICM.cpp<br>
          >> ./Scalar/MemCpyOptimizer.cpp<br>
          >> ./Scalar/MergedLoadStoreMotion.cpp<br>
          >> ./Scalar/NewGVN.cpp<br>
          >> ./Utils/VNCoercion.cpp<br>
          >><br>
          >> I glanced over all the uses in these files and I
          couldn't find any<br>
          >> usage that requires sizes to match.  Actually most
          clients check<br>
          >> access sizes themselves. Most don't need equal sizes,
          just need one to<br>
          >> be smaller than the other.<br>
          ><br>
          > Does aliasing actually check both ways?<br>
          > Otherwise, alias (A, B) will give different results than
          alias (B, A).<br>
          <br>
          Sorry for the delay.<br>
          I'm not sure I understood what you wrote, sorry.  What you
          wrote is true in<br>
          general, but I don't see how MustAlias in particular is worse
          than the other<br>
          AA results.</blockquote>
      </div>
      <div><br>
      </div>
      <div>Historically, in llvm, we have guaranteed that alias(a, b)
        ==alias(b, a)</div>
    </blockquote>
    <br>
    We should continue to do so.<br>
    <br>
    Thanks again,<br>
    Hal<br>
    <br>
    <blockquote
cite="mid:CAF4BwTWH6cYCqKNo4LpH3o+-YxcL-=vSK2ZQ=PXJNkNNq0KnLg@mail.gmail.com"
      type="cite">
      <div><br>
      </div>
      <div>If it does:</div>
      <div><br>
      </div>
      <div>If start (a) == start (b)</div>
      <div>  If size(b) < size(a)</div>
      <div>      Return mustalias</div>
      <div>  Return may or partial</div>
      <div><br>
      </div>
      <div>It will give different answers for alias(a, b) and alias (b,
        a)</div>
      <div><br>
      </div>
      <div>Hence my question about whether it checked whether *either*
        was smaller, or just in one direction.</div>
      <div><br>
      </div>
      <div class="gmail_quote">
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">  And how
          not enforcing that access sizes are equal changes<br>
          things with respect to commutativity either.  Maybe I
          completely missed your<br>
          point..<br>
          <br>
          Nuno<br>
          <br>
        </blockquote>
      </div>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory</pre>
  </body>
</html>