[llvm-dev] PartialAlias: different start addresses

Daniel Berlin via llvm-dev llvm-dev at lists.llvm.org
Fri Jul 14 13:25:37 PDT 2017


Yeah, we definitely don't implement this, and i'm not sure why we would.
The best guess i can come up with is that it's really attempting to say
something like

1 = *A+4 (size 4)
2 = *A (size 8)

load from 2 PartialAlias 1 (not MustAlias)

Which is conservative but correct, and meant to ensure alias(1, 2) ==
alias(2, 1)

That would match with our definition of MustAlias, which would not allow 2
MustAlias 1 either.

There isn't really a good set of consistent answers between most compilers
when the sizes are different but memory addresses overlap.

IE it seems reasonable to say that a load of 2 MustAlias 1 but a load of 1
PartialAlias 2. It also seems reasonable to declare these both PartialAlias.

In any case, our current implementation, from what i remember (i didn't
trace *every* path), says:

if MemoryLocations are same size:
may if no idea
must if the same
partial if we can prove overlap

If MemoryLocations are different sizes:
may if no idea
partial if overlap
never must



On Fri, Jul 14, 2017 at 1:06 PM, Hal Finkel via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

>
> On 07/14/2017 03:00 PM, Davide Italiano via llvm-dev wrote:
>
>> On Fri, Jul 14, 2017 at 12:50 PM, Nuno Lopes via llvm-dev
>> <llvm-dev at lists.llvm.org> wrote:
>>
>>> Hi,
>>>
>>> I going through the alias analysis documentation
>>> (http://llvm.org/docs/AliasAnalysis.html) and noticed the following in
>>> the
>>> definition of PartialAlias:
>>> "
>>> The PartialAlias response is used when the two memory objects are known
>>> to
>>> be overlapping in some way, but *do not start at the same address*.
>>> "
>>>
>>> Is it really required that the objects do no start at the same address?
>>> if
>>> that's the case the AA algorithm would need to prove that.
>>> I'm asking this because:
>>> 1) This condition seems very strict and I don't think it's met in a few
>>> places I found by manual inspection
>>>
>> If I read the definition correctly, at least our Andersens' AA
>> implementation violates it.
>> see:
>>
>> AliasResult CFLAndersAAResult::alias(const MemoryLocation &LocA,
>>                                       const MemoryLocation &LocB) {
>>    if (LocA.Ptr == LocB.Ptr)
>>      return LocA.Size == LocB.Size ? MustAlias : PartialAlias;
>>
>>
>> (i.e. the two objects are overlapping here *and* start at the same
>> address).
>>
>
> I've never noticed that part of the definition myself. I'm fairly certain
> that's not what we actually implement.
>
>  -Hal
>
> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>
>
> --
> Hal Finkel
> Lead, Compiler Technology and Programming Languages
> Leadership Computing Facility
> Argonne National Laboratory
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170714/02052718/attachment.html>


More information about the llvm-dev mailing list