[llvm] [AMDGPU] Correctly merge noalias scopes during lowering of LDS data. (PR #131664)

Sirish Pande via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 10 13:16:03 PDT 2025


srpande wrote:

> The premise is reasonable - the aliasing information in lds lowering might be suboptimal.
> 
> The variables all go in different slots of a struct though so no lds variables alias any other, outside of the externally allocated hack thing where all of them alias every other externally allocated one. So I'm a little confused how more elaborate aliasing information helps.
> 
> edit: better to rebase on main than to merge, gives a single commit with the content in to look at

You are right, that all the LDS variables go in different slots and do not alias with each other. However, sometimes alias.scope or noalias metadata linger from previous optimizations. In the presence of those metadata, current lowering pass creates an empty set ( see llvm/test/CodeGen/AMDGPU/lower-lds-struct-aa-merge.ll line 51).  This makes aliasing more conservative, and adds aliasing information between loads and stores where it does not need to. 

This pass attempts to remove that ambiguity, and aliasing information more precise. Using the following:
`opt -S -aa-pipeline=basic-aa,scoped-noalias-aa -passes=aa-eval -evaluate-aa-metadata -print-all-alias-modref-info -disable-output`
will give  you detailed information about how we are creating more aliasing info during lowering LDS pass.


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


More information about the llvm-commits mailing list