[PATCH] D77421: [WPD] Avoid noalias assumptions in unique return value optimization

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 5 11:44:44 PDT 2020


dblaikie added a comment.

In D77421#1960852 <https://reviews.llvm.org/D77421#1960852>, @inglorion wrote:

> @dblaikie: My understanding is that LLVM reserves the right to assume that distinct globals never alias and optimize based on that (e.g. as mentioned under https://releases.llvm.org/10.0.0/docs/AliasAnalysis.html#the-basicaa-pass), and that declaring globals as zero-sized is the accepted way to avoid that (e.g. as mentioned in https://bugs.llvm.org/show_bug.cgi?id=31675#c5).
>
> So it's not so much improperly applied TBAA as it is an assumption that LLVM allows itself to make regardless of type, with a special exception for zero-sized types.


Ah - thanks! This is probably sufficiently out of my purview then, but little curious if you've time to explain it further: How does this feature work? Why could these two globals end up aliasing in practice before? Are these globals never actually defined?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77421/new/

https://reviews.llvm.org/D77421





More information about the llvm-commits mailing list