[llvm-branch-commits] [llvm] [Attributor] Take the address space from addrspacecast directly (PR #108258)

Shilei Tian via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sun Sep 15 20:45:14 PDT 2024


shiltian wrote:

> > If the value to be analyzed is directly from addrspacecast, we take the source
> > address space directly.
> 
> I don't think this is valid in general. You are allow to speculatively produce invalid addrspacecasts. For example:
> 
> ```
> __generic int* g_ptr = ...;
> __local int* l_ptr = (__local int*) g_ptr;
> if (is_shared(g_ptr)) 
>   *l_ptr = 1;
> ```

That doesn't matter because the scope is the instruction. In your example here, the pointer of the store is already in the specific address space. That will not change no matter whether the branch is taken or not. `AAAddressSpace` doesn't say `g_ptr` is in what address space. It just changes the pointer operand of memory instruction.

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


More information about the llvm-branch-commits mailing list