[llvm] r212572 - Improve BasicAA CS-CS queries

Nick Lewycky nlewycky at google.com
Mon Jul 14 17:51:35 PDT 2014


On 8 July 2014 16:16, Hal Finkel <hfinkel at anl.gov> wrote:

> @@ -170,14 +190,16 @@ AliasAnalysis::getModRefInfo(ImmutableCa
>    if (onlyAccessesArgPointees(CS1B)) {
>      AliasAnalysis::ModRefResult R = NoModRef;
>      if (doesAccessArgPointees(CS1B)) {
> -      MDNode *CS1Tag =
> CS1.getInstruction()->getMetadata(LLVMContext::MD_tbaa);
>        for (ImmutableCallSite::arg_iterator
>             I = CS1.arg_begin(), E = CS1.arg_end(); I != E; ++I) {
>          const Value *Arg = *I;
>          if (!Arg->getType()->isPointerTy())
>            continue;
> -        Location CS1Loc(Arg, UnknownSize, CS1Tag);
> -        if (getModRefInfo(CS2, CS1Loc) != NoModRef) {
> +        ModRefResult ArgMask;
> +        Location CS1Loc =
> +          getArgLocation(CS1, (unsigned) std::distance(CS1.arg_begin(),
> I),
> +                         ArgMask);
>

We compute the mask of "what CS1 might do to this", ie., for memset it's
"Mod" only ...


> +        if ((getModRefInfo(CS2, CS1Loc) & ArgMask) != NoModRef) {
>

... 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.

The testcase is in PR20303.

Nick


>            R = Mask;
>            break;
>          }
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140714/c9c3da37/attachment.html>


More information about the llvm-commits mailing list