[LLVMdev] BasicAliasAnalysis: constant does not alias with noalias parameter

Dan Gohman gohman at apple.com
Thu Nov 12 10:54:30 PST 2009


On Nov 12, 2009, at 1:05 AM, Hans Wennborg wrote:

> After discussing with Nick Lewycky in the IRC channel, here comes a less aggressive patch.
> 
> We were worried that a constant pointer could alias with a GlobalValue.

It can. You can have a GetElementPtr ConstantExpr which aliases a
GlobalValue, for example. What problem does this cause though?

> Also, if one pointer could be a GlobalValue and the other a GlobalAlias with the GlobalValue as aliasee.
> However, I was not able to produce a test where this happens wihout the getUnderlyingObject() returning the same value.

AliasAnalysis::isIdentifiedObject knows that GlobalAlias and ConstantExpr
values are not "identified objects", so I don't see the trouble here. Also,
getUnderlyingObject() knows how to look through (non-weak) GlobalAliases.

Dan

> It would be nice if someone could produce such a test case, or dismiss the possibility of this happening.
> 
> 
> Anyway, saying that a Constant does not alias with a non-const isIdentifiedObject object seems safe.
> 
> / Hans
> 





More information about the llvm-dev mailing list