[llvm] r234814 - Add new getModRefInfo API to determine whether an Instruction and a call modify the same memory

Chandler Carruth chandlerc at google.com
Tue Apr 14 06:03:06 PDT 2015


On Mon, Apr 13, 2015 at 4:32 PM Daniel Berlin <dberlin at dberlin.org> wrote:

> Author: dannyb
> Date: Mon Apr 13 18:25:41 2015
> New Revision: 234814
>
> URL: http://llvm.org/viewvc/llvm-project?rev=234814&view=rev
> Log:
> Add new getModRefInfo API to determine whether an Instruction and a call
> modify the same memory
>
> Modified:
>     llvm/trunk/include/llvm/Analysis/AliasAnalysis.h
>     llvm/trunk/lib/Analysis/AliasAnalysis.cpp
>
> Modified: llvm/trunk/include/llvm/Analysis/AliasAnalysis.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/AliasAnalysis.h?rev=234814&r1=234813&r2=234814&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/Analysis/AliasAnalysis.h (original)
> +++ llvm/trunk/include/llvm/Analysis/AliasAnalysis.h Mon Apr 13 18:25:41
> 2015
> @@ -503,6 +503,10 @@ public:
>    ModRefResult getModRefInfo(const VAArgInst* I, const Value* P, uint64_t
> Size){
>      return getModRefInfo(I, Location(P, Size));
>    }
> +  /// getModRefInfo - Return information about whether a call and an
> instruction
> +  /// may refer to the same memory locations.
>

Please follow the new doxygen coding standards.


> +  ModRefResult getModRefInfo(Instruction *I,
> +                             ImmutableCallSite Call);
>
>    /// getModRefInfo - Return information about whether two call sites may
> refer
>    /// to the same set of memory locations.  See
>
> Modified: llvm/trunk/lib/Analysis/AliasAnalysis.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasAnalysis.cpp?rev=234814&r1=234813&r2=234814&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Analysis/AliasAnalysis.cpp (original)
> +++ llvm/trunk/lib/Analysis/AliasAnalysis.cpp Mon Apr 13 18:25:41 2015
> @@ -82,6 +82,23 @@ void AliasAnalysis::addEscapingUse(Use &
>    AA->addEscapingUse(U);
>  }
>
> +AliasAnalysis::ModRefResult
> +AliasAnalysis::getModRefInfo(Instruction *I, ImmutableCallSite Call) {
> +  // We may have two calls
> +  if (auto CS = ImmutableCallSite(I)) {
> +    // Check if the two calls modify the same memory
> +    return getModRefInfo(Call, CS);
> +  } else {
> +    // Otherwise, check if the call modifies or references the
> +    // location this memory access defines.  The best we can say
> +    // is that if the call references what this instruction
> +    // defines, it must be clobbered by this location.
> +    const AliasAnalysis::Location DefLoc = AA->getLocation(I);
> +    if (getModRefInfo(Call, DefLoc) != AliasAnalysis::NoModRef)
> +      return AliasAnalysis::ModRef;
> +  }
> +  return AliasAnalysis::NoModRef;
> +}
>
>  AliasAnalysis::ModRefResult
>  AliasAnalysis::getModRefInfo(ImmutableCallSite CS,
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150414/4b8ee236/attachment.html>


More information about the llvm-commits mailing list