[PATCH] D104513: [AMDGPU] Simplify getReservedNumSGPRs
Madhur Amilkanthwar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 18 02:45:57 PDT 2021
madhur13490 created this revision.
madhur13490 added reviewers: arsenm, rampitec.
Herald added subscribers: foad, kerbowa, hiraditya, t-tye, tpr, dstuttard, yaxunl, nhaehnle, jvesely, kzhuravl.
madhur13490 requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.
This is a followup patch on D103636 <https://reviews.llvm.org/D103636> where
it seemed checking on amdgpu-calls and
amdgpu-stack-objects is unnecessary. Removing these
checks didn't regress any tests functionally.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D104513
Files:
llvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp
Index: llvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp
@@ -723,13 +723,11 @@
unsigned GCNSubtarget::getReservedNumSGPRs(const Function &F) const {
// The logic to detect if the function has
// flat scratch init is same as how MachineFunctionInfo derives.
+ bool isEntry = AMDGPU::isEntryFunctionCC(F.getCallingConv());
bool FunctionHasFlatScratchInit = false;
- bool HasCalls = F.hasFnAttribute("amdgpu-calls");
- bool HasStackObjects = F.hasFnAttribute("amdgpu-stack-objects");
- if (hasFlatAddressSpace() && AMDGPU::isEntryFunctionCC(F.getCallingConv()) &&
- (isAmdHsaOrMesa(F) || enableFlatScratch()) &&
- !flatScratchIsArchitected()) {
- if (HasCalls || HasStackObjects || enableFlatScratch())
+ if (hasFlatAddressSpace() && isEntry && !flatScratchIsArchitected() &&
+ (isAmdHsaOrMesa(F) || enableFlatScratch())) {
+ if (enableFlatScratch())
FunctionHasFlatScratchInit = true;
}
return getBaseReservedNumSGPRs(FunctionHasFlatScratchInit);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104513.352951.patch
Type: text/x-patch
Size: 1149 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210618/5a584c32/attachment.bin>
More information about the llvm-commits
mailing list