[cfe-dev] [LLVMdev] no-alias generated as result of restrict function arguments

Joerg Sonnenberger joerg at britannica.bec.de
Wed Dec 12 14:45:57 PST 2012


On Wed, Dec 12, 2012 at 01:59:55PM -0800, Dan Gohman wrote:
> On Wed, Dec 12, 2012 at 1:26 PM, Joerg Sonnenberger
> > The original issue is that clang maps restrict on function arguments to
> > NoAlias and that makes compares against the address of global variables
> > false. Minimal test case:
> >
> > @y = external global i32
> >
> > define zeroext i1 @t(i32* noalias %x) nounwind uwtable readnone {
> > entry:
> >   %cmp = icmp eq i32* %x, @y
> >   ret i1 %cmp
> > }
> 
> The bug here isn't in clang's use of noalias or in BasicAliasAnalysis'
> implementation of noalias; it's in the code that's optimizing the
> icmp.

I am just saying that the comments in BasicAliasAnalysis makes me wonder
if it has the same kind of problem.

Joerg



More information about the cfe-dev mailing list