<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 8 July 2014 16:16, 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 id=":4gi" class="a3s" style="overflow:hidden">@@ -170,14 +190,16 @@ AliasAnalysis::getModRefInfo(ImmutableCa<br>
   if (onlyAccessesArgPointees(CS1B)) {<br>
     AliasAnalysis::ModRefResult R = NoModRef;<br>
     if (doesAccessArgPointees(CS1B)) {<br>
-      MDNode *CS1Tag = CS1.getInstruction()->getMetadata(LLVMContext::MD_tbaa);<br>
       for (ImmutableCallSite::arg_iterator<br>
            I = CS1.arg_begin(), E = CS1.arg_end(); I != E; ++I) {<br>
         const Value *<span class="il">Arg</span> = *I;<br>
         if (!<span class="il">Arg</span>->getType()->isPointerTy())<br>
           continue;<br>
-        Location CS1Loc(<span class="il">Arg</span>, UnknownSize, CS1Tag);<br>
-        if (getModRefInfo(CS2, CS1Loc) != NoModRef) {<br>
+        ModRefResult <span class="il">ArgMask</span>;<br>
+        Location CS1Loc =<br>
+          getArgLocation(CS1, (unsigned) std::distance(CS1.arg_begin(), I),<br>
+                         <span class="il">ArgMask</span>);<br></div></blockquote><div><br></div><div>We compute the mask of "what CS1 might do to this", ie., for memset it's "Mod" only ...</div><div>

 </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id=":4gi" class="a3s" style="overflow:hidden">
+        if ((getModRefInfo(CS2, CS1Loc) & <span class="il">ArgMask</span>) != NoModRef) {<br></div></blockquote><div><br></div><div>... then we compute ModRefInfo for CS2, which might be "Ref" for a function that is readonly. Mod & Ref = NoModRef and we proceed as if the memset that only writes through a pointer and the readonly function that reads through a pointer do not interact.</div>

<div><br></div><div>The testcase is in PR20303.</div><div><br></div><div>Nick</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id=":4gi" class="a3s" style="overflow:hidden">


           R = <span class="il">Mask</span>;<br>
           break;<br>
         }<br></div></blockquote></div><br><br></div></div>