[llvm] [BasicAA] Guess reasonable contexts for separate storage hints (PR #76770)

David Goldblatt via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 3 10:01:36 PST 2024


davidtgoldblatt wrote:

> Can you please first submit a PR to enable the separate storage functionality by default? It seems to be essentially free right now, and we may have trouble enabling it in the future if it is made more expensive first.

Will do.

> I'm wondering whether the motivating case could be solved by using (must-exec) separate_storage assumptions in the entry block to infer `noalias` on function parameters. Assuming that is a valid transform, we would benefit from other noalias-based optimizations as well. (We could probably even drop the assume in that case, as noalias should enable strictly more optimizations, and gets preserved during inlining using scoped AA metadata.)

I think noalias hinting can't be enough; separate storage hints actually end up being stronger than the scoped noalias stuff post-inlining, because the scopes don't propagate to accesses in the calling function (i.e. it can't be used to tell the caller that the caller's memory accesses don't alias one another; the metadata still just applies to accesses that were there in the inlined function). So these hints can be used in cases where there's sort of a split between core library code owned by experts, who want the hints to benefit the code written by nonexperts. Example: https://gcc.godbolt.org/z/Tfae5d5dM

https://github.com/llvm/llvm-project/pull/76770


More information about the llvm-commits mailing list