<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jul 15, 2017 at 5:35 AM, Hal Finkel <span dir="ltr"><<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><br>
On 07/15/2017 04:51 AM, Nuno Lopes wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 07/14/2017 04:37 PM, Nuno Lopes wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Thank you all for your replies.<br>
So here seems to be an agreement that the documentation for PartialAlias is incorrect.<br>
<br>
Daniel: now you got me wondering about MustAlias. This is what the docs say:<br>
"The MustAlias response may only be returned if the two memory objects are *guaranteed to always start at exactly the same location*"<br>
<br>
This statement is regardless of the access sizes.  For example, in 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 access size.<br>
<br>
So, does must needs to check for access sizes?  If so, SCEV AA is buggy and the documentation needs tweaking.<br>
</blockquote>
<br>
I'm under the impression that there is code that depends on the size check, but I don't trust my recollection in this regard. SCEV AA is known to cause miscompiles, IIRC, maybe you just found out why ;)<br>
</blockquote>
<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.c<wbr>pp<br>
./Scalar/DeadStoreElimination.<wbr>cpp<br>
./Scalar/GVN.cpp<br>
./Scalar/LICM.cpp<br>
./Scalar/LoopVersioningLICM.cp<wbr>p<br>
./Scalar/MemCpyOptimizer.cpp<br>
./Scalar/MergedLoadStoreMotion<wbr>.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 usage that requires sizes to match.  Actually most clients check access sizes themselves. Most don't need equal sizes, just need one to be smaller than the other.<br></blockquote></div></div></blockquote><div><br></div><div>Does aliasing actually check both ways?</div><div>Otherwise, alias (A, B) will give different results than alias (B, A).</div><div> </div></div></div></div>