[llvm-dev] Potential issue with noalias @malloc and @realloc

Daniel Berlin via llvm-dev llvm-dev at lists.llvm.org
Tue Apr 11 19:02:18 PDT 2017

> > It would require semantic changes to llvm ir to fix this to properly
> > express object lifetimes that is compatible with all the random babble
> > standards have written down :)
> > For now, the only sane solution IMHO, is to say that no alias implies
> > pointer inequality, regardless of the standards. Because the above can
> > occur in any situation noalias exists but they are allowed to be pointer
> > equal (as mentioned, it's trivial to make this happen in TBAA).
> Just to be clear, you're suggesting that we no longer mark malloc's
> return value as noalias?

Actually, i'd suggest just letting it be a bug :)
That's what other compilers seem to do.
You could hack around this in clang by using the !alias.scope and !noalias
form, and not attaching the scope past the lifetime end.

But we don't optimize that.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170411/1a46a331/attachment.html>

More information about the llvm-dev mailing list