[llvm-commits] [PATCH] Extend BasicAliasAnalysis to recognize cyclic NoAlias phis in loops

Arnold Schwaighofer arnolds at codeaurora.org
Thu Aug 30 09:08:50 PDT 2012


Hi Tobias,

I have not looked at scev-aa (at least not further than enabling it and 
noticing that it could not show no-alias). You are right that scev-aa 
should handle this. But scev-aa is not used by clang at -O2/-O3 so I 
looked at improving basic-aa.

I don't really do any deep loop analysis. The loop part is handled by 
recursion on phi nodes that is already in the basic-aa code.


On 8/30/2012 10:26 AM, Tobias Grosser wrote:
> On 08/30/2012 04:48 PM, Arnold Schwaighofer wrote:
>> Ping.
>>
>> On 8/9/2012 10:54 AM, Arnold Schwaighofer wrote:
>>> Hi,
>>>
>>> BasicAliasAnalysis should recognize phis that have incoming values from
>>> outside the loop that are known to not alias and whose other incoming
>>> values do not change this fact because they perform congruent
>>> operations.
>>>
>>> Example: We want to prove that ptr_phi and ptr_phi2 do not alias each
>>> other.
>
> Hi Arnold,
>
> I have really no idea about the alias analysis, but I was surprised to
> see that you add some kind of loop analysis to the basic alias analysis.
> From my point of view the scev alias analysis would be the better match.
> Running -scev-aa on your test case still gives:
>
> AliasSet[0x1530080, 3] may alias, Mod/Ref
>      Pointers: (i32* %ptr_phi, 4), (i32* %ptr2_phi, 4), (i32* %coeff, 4)
>
> AliasSet[0x1530300, 1] must alias, Mod        forwarding to 0x1530080
>
> Asking myself, why this is the case I looked at the scev values of
> %ptr_phi and %ptr2_phi.
>
> %ptr_phi = phi i32* [ %ptr, %entry ], [ %ptr_inc, %while.body ]
>    -->  {(4 + %ptr2)<nsw>,+,4}<nw><%while.body>
> %ptr2_phi = phi i32* [ %ptr2, %entry ], [ %ptr2_inc, %while.body ]
>    -->  {%ptr2,+,4}<nw><%while.body>
>
> Digging a little bit into the debugger, the scev-aa can even figure out
> that the offset of between these two pointers is 4. However, for some
> reason it does not prove that they don't alias. Do you understand why
> the scev-aa can not handle this?
>
> Cheers
> Tobi



-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
hosted by The Linux Foundation



More information about the llvm-commits mailing list