[PATCH] D42381: [DA] Correct size parameter from dependency analysis to AA

Hal Finkel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 9 03:31:17 PDT 2018


hfinkel added a comment.

In https://reviews.llvm.org/D42381#1061379, @dmgreen wrote:

> > Does the fallback add anything?
>
> We need to detect things like this as mustalias (to find the flow dependence), not mayalias (confused):
>
>   for (int i = 0; i < n; i++) {
>     A[i + 2] = i;
>     ... = A[i];
>   
>
> Unless you mean just do the alias analysis like this:?
>
>   return AA->alias(GetUnderlyingObject(LocA.Ptr), MemoryLocation::UnknownSize, LocA.AATags, GetUnderlyingObject(LocB.Ptr), MemoryLocation::UnknownSize, LocB.AATags)
>


Just do:

  return AA->alias(LocA.Ptr, MemoryLocation::UnknownSize, LocA.AATags, LocB.Ptr, MemoryLocation::UnknownSize, LocB.AATags)

there's no need to call `GetUnderlyingObject` here explicitly. When you pass an unknown size, that's essentially what BasicAA is doing anyway (since it has no size information, AA can only look at the metadata and the underlying objects for aliasing information).


https://reviews.llvm.org/D42381





More information about the llvm-commits mailing list