[LLVMdev] alias set collapse and LICM

Andrew Trick
Fri, 12 Jun 2015 20:00:52 -0000

> On Apr 27, 2015, at 3:44 PM, Sanjoy Das <sanjoy at
playingwithpointers.com> wrote:
>
>> Can you explain why the alias sets are collapsed into one here?
>
> If I'm reading the code correctly, it is because the readonly call
> aliases all of %a, %b and %c.  Since two pointers can be in two
> different alias sets only if they do not alias, %a has to be in the
> same alias set as the read only call and so does %b and %c.
> Therefore, all of them have to be in the same alias set.
>
>> Can that collapsing simply be avoided for read-only calls without
creating a second alias set?
>
> I have not yet come up with a simple scheme to solve that problem
> within AliasSetTracker.  Obviously, that does not mean that there
> isn't one.

I never saw a good conclusion to this thread. Clearly, collapsing all of the
alias sets whenever the loop contains a call with “AnyWhere” ModRef behavior is
not an effective design. AliasSet partitions need to remain disjoint, but that
doesn’t mean all memory access needs to be partitioned. There should be one
special set of accesses that simply alias with everything without causing the
partitions to collapse. I haven’t thought through how to make this change with
our AliasSetTracker API though.

Andy