[llvm] [AMDGPU] Avoid setting GLC for image atomics when result is unused (PR #150742)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 19 02:27:57 PDT 2025


jayfoad wrote:

Agree with Matt. Although the ISA opcode is the same, you should define separate MachineInstrs for the no-return forms which do not have the def operand for the returned value.

The current patch has two problems:
1. The register allocator will still allocate a register for the unused result value, which is a bit wasteful, and could actually increase vgpr usage in some cases.
2. These MachineInstrs still satisfy SIInstrInfo::isAtomicRet so SIInsertWaitcnts thinks that they increment VMCNT (aka LOADCNT) which will cause it to insert incorrect waitcnts in some cases.

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


More information about the llvm-commits mailing list