From e19bc2ee0fb20f05a9acf53b9e18f59c3b130960 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Fri, 29 Dec 2017 17:18:21 +0000 Subject: AMDGPU: Use unique PSVs for buffer resources Also fixes using the wrong memory type for some intrinsics when custom lowering them. llvm-svn: 321557 --- llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h') diff --git a/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h b/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h index 7ac755be04d..02e63f0258e 100644 --- a/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h +++ b/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h @@ -137,12 +137,11 @@ class SIMachineFunctionInfo final : public AMDGPUMachineFunction { // Stack object indices for work item IDs. std::array DebuggerWorkItemIDStackObjectIndices = {{0, 0, 0}}; - AMDGPUBufferPseudoSourceValue BufferPSV; - + DenseMap> BufferPSVs; DenseMap> ImagePSVs; - private: unsigned LDSWaveSpillSize = 0; unsigned NumUserSGPRs = 0; @@ -634,9 +633,13 @@ public: return LDSWaveSpillSize; } - // FIXME: These should be unique - const AMDGPUBufferPseudoSourceValue *getBufferPSV() const { - return &BufferPSV; + const AMDGPUBufferPseudoSourceValue *getBufferPSV(const SIInstrInfo &TII, + const Value *BufferRsrc) { + assert(BufferRsrc); + auto PSV = BufferPSVs.try_emplace( + BufferRsrc, + llvm::make_unique(TII)); + return PSV.first->second.get(); } const AMDGPUImagePseudoSourceValue *getImagePSV(const SIInstrInfo &TII, -- cgit v1.2.3