[llvm] [GlobalISel] Preserve volatile and atomic undef/poison stores (PR #200099)

Justin Lebar via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 19 11:32:33 PDT 2026


jlebar wrote:

@arsenm, thank you for the review!

> the AMDGPU changes are unrelated. Falling short of properly implementing these as directly handled types, I'd rather leave unhandled address-spaces as-is as a todo

I think I need to change *something* in the AMDGPU backend, or its tests.  From the PR description:

> Fixing this exposes an issue in the AMDGPU backend. If you addrspacecast a pointer to an illegal address space, we fold the pointer to poison. If you then try to store such a pointer, previously we would elide the store, but now we sometimes keep it. (Note, the pointer in the illegal address space here is the value being stored, not the address that we're storing to.)
>
> On AMDGPU, this causes backend crashes. There are (apparently) tests that store such values, and the backend wasn't able to lower these "new" instructions. We teach the backend to handle these stores by casting the pointer to an integer first.

>From https://github.com/llvm/llvm-project/pull/200099#issuecomment-4580755384:

> I have no idea why tests are creating pointers in illegal address spaces and then trying to store them. (Note we're not storing to the illegal addresses. We're just storing the pointer values.) The only value you can store in this way is poison! If you prefer I could try to change the tests to use legal address spaces, then we probably wouldn't need to edit the AMDGPU backend at all.

I updated the PR to handle these stores in AMDGPUInstructionSelector.cpp, which I think might be what you're asking for in https://github.com/llvm/llvm-project/pull/200099#discussion_r3586100876, but if you prefer I'm very happy just to delete the tests!  (Or to do anything else.)

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


More information about the llvm-commits mailing list