[PATCH] D103636: [AMDGPU][IndirectCalls] Fix register usage propagation for indirect/external calls

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 8 11:43:13 PDT 2021


arsenm added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp:633
+  ModuleMaxVGPRs = 0;
+  for (const Function &F : M) {
+    if (!AMDGPU::isEntryFunctionCC(F.getCallingConv())) {
----------------
Add a comment?


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp:1047
+          // Subtract them here so that they don't get added twice.
+          MaxSGPR = ModuleMaxSGPRs - ExtraSGPRs - 1;
+          MaxVGPR = ModuleMaxVGPRs - 1;
----------------
I think for accounting purposes it would be nicer to not include these in the function totals to begin with, but I guess it doesn't really matter


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp:726-727
+  bool FunctionHasFlatScratchInit = false;
+  bool HasCalls = F.hasFnAttribute("amdgpu-calls");
+  bool HasStackObjects = F.hasFnAttribute("amdgpu-stack-objects");
+  if (hasFlatAddressSpace() && AMDGPU::isEntryFunctionCC(F.getCallingConv()) &&
----------------
I don't like relying on these attributes. Can you just assume they are true?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103636/new/

https://reviews.llvm.org/D103636



More information about the llvm-commits mailing list