diff options
author | Jon Chesterfield <jonathanchesterfield@gmail.com> | 2023-07-15 20:38:15 +0100 |
---|---|---|
committer | Jon Chesterfield <jonathanchesterfield@gmail.com> | 2023-07-15 21:37:21 +0100 |
commit | 6043d4dfec1e47b6e314f3643f576ab808f246dc (patch) | |
tree | a926f50f95acc00a5640bc46df1b646e78f75948 /llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp | |
parent | ac5d5351d42ab74cfc47964aa0ca94655cf7e7c7 (diff) | |
download | llvm-6043d4dfec1e47b6e314f3643f576ab808f246dc.zip llvm-6043d4dfec1e47b6e314f3643f576ab808f246dc.tar.gz llvm-6043d4dfec1e47b6e314f3643f576ab808f246dc.tar.bz2 |
[amdgpu] Accept an optional max to amdgpu-lds-size attribute for use in PromoteAlloca
Diffstat (limited to 'llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp')
-rw-r--r-- | llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp b/llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp index 8f3bb62..44bbfe6 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp @@ -10,6 +10,7 @@ #include "AMDGPU.h" #include "AMDGPUPerfHintAnalysis.h" #include "AMDGPUSubtarget.h" +#include "Utils/AMDGPUBaseInfo.h" #include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/IR/ConstantRange.h" #include "llvm/IR/Constants.h" @@ -43,10 +44,16 @@ AMDGPUMachineFunction::AMDGPUMachineFunction(const Function &F, // Assume the attribute allocates before any known GDS globals. StaticGDSSize = GDSSize; + // Second value, if present, is the maximum value that can be assigned. + // Useful in PromoteAlloca or for LDS spills. Could be used for diagnostics + // during codegen. + std::pair<unsigned, unsigned> LDSSizeRange = AMDGPU::getIntegerPairAttribute( + F, "amdgpu-lds-size", {0, UINT32_MAX}, true); + // The two separate variables are only profitable when the LDS module lowering // pass is disabled. If graphics does not use dynamic LDS, this is never // profitable. Leaving cleanup for a later change. - LDSSize = F.getFnAttributeAsParsedInteger("amdgpu-lds-size", 0); + LDSSize = LDSSizeRange.first; StaticLDSSize = LDSSize; CallingConv::ID CC = F.getCallingConv(); |