[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:44 PDT 2025
================
@@ -8780,8 +8780,10 @@ SDValue SITargetLowering::lowerImage(SDValue Op,
}
unsigned CPol = Op.getConstantOperandVal(ArgOffset + Intr->CachePolicyIndex);
- 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 && !Op.getValue(0).use_empty())
+ CPol |= AMDGPU::CPol::GLC;
+
----------------
arsenm wrote:
Don't you need to also change the opcode to do this? The asm changes only change the bit and don't drop the output register.
https://github.com/llvm/llvm-project/pull/150742
More information about the llvm-commits
mailing list