[llvm-dev] valid BasicAA behavior?
Michael Kruse via llvm-dev
llvm-dev at lists.llvm.org
Wed Mar 18 09:12:15 PDT 2020
Am Di., 17. März 2020 um 16:56 Uhr schrieb Chawla, Pankaj via llvm-dev
<llvm-dev at lists.llvm.org>:
> All I am expecting from DA is a direction vector containing (*).
There seems to be a bug in DI, see Felipe's answer.
> I think the main problem is that currently there is no exact way DA can query AliasAnalysis in a ‘conservatively correct’ manner.
> Using UnknownSize seems to be an approximate solution (workaround).
Passing an unknown size is conservatively correct. That is, it must be
correct for any possible size.
Yes, we could be better if we know all the array elements that are
accessed. Unfortunately it is also difficult, e.g. because the access
range depends on `n`, ie is non-constant. The AA interface doesn't
even allow querying for non-constant sizes.
> How do you guys feel about setting the initial cached result as MayAlias instead of NoAlias if the query is performed for UnknownSize?
> If during alias query recursion we hit the same phi query again, we will return a conservative ‘MayAlias’ knowing that we have hit a cycle (loop).
Since aliasPHI looks for any incoming value contradicting the NoAlias
assumption, it would be equivalant to always return MayAlias.
More information about the llvm-dev