[llvm] [AMDGPU] Avoid setting GLC for image atomics when result is unused (PR #150742)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 26 17:26:53 PDT 2025
================
@@ -2123,8 +2123,10 @@ bool AMDGPUInstructionSelector::selectImageIntrinsic(
assert((!IsTexFail || DMaskLanes >= 1) && "should have legalized this");
unsigned CPol = MI.getOperand(ArgOffset + Intr->CachePolicyIndex).getImm();
- if (BaseOpcode->Atomic)
- CPol |= AMDGPU::CPol::GLC; // TODO no-return optimization
+ // Keep GLC only when the atomic's result is actually used.
+ if (BaseOpcode->Atomic && VDataOut && !MRI->use_empty(VDataOut))
----------------
arsenm wrote:
use_nodbg_empty
https://github.com/llvm/llvm-project/pull/150742
More information about the llvm-commits
mailing list