[LLVMdev] "Best" alias analysis algorithm
sabre at nondot.org
Mon Apr 25 12:40:54 PDT 2005
On Mon, 25 Apr 2005, Vladimir Prus wrote:
> The GlobalsModRef::getModRefInfo has this logic:
> // If we are asking for mod/ref info of a direct call with a pointer to a
> // global we are tracking, return information if we have it.
> if (GlobalValue *GV = const_cast<GlobalValue*>(getUnderlyingObject(P)))
> if (GV->hasInternalLinkage())
> So, no information is produced for external variables, the function calls
> Aliasanalysis::getModRefInfo, which sees that called function may write to
> memory, and returns true for all global variables.
> Anything I can do about it? What I what is minimally accurate information
> about all global variables a function may modify. "Modifies them all" is
> clearly not even minimally accurate.
Oh ok, now I remember. The deal here is that "globals-modref" is supposed
to be a very simple mod/ref analysis that does no "pointer analysis" at
all. In particular, it only tracks globals that it knows "never have
their address taken". If a global has non-internal linkage, the compiler
can't know that something outside of the program doesn't take its address
and pass around its address.
While in this case, globals modref could handle this case, you really want
something more powerful like -ds-aa.
More information about the llvm-dev