[PATCH] D150609: [AMDGPU] Do not assume stack size for PAL code object indirect calls

Baptiste Saleil via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 24 13:42:00 PDT 2023


bsaleil updated this revision to Diff 525325.
bsaleil added a comment.

Addressed review comments


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150609

Files:
  llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
  llvm/test/CodeGen/AMDGPU/resource-usage-pal.ll


Index: llvm/test/CodeGen/AMDGPU/resource-usage-pal.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/AMDGPU/resource-usage-pal.ll
@@ -0,0 +1,13 @@
+; RUN llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx1100 -verify-machineinstrs < %s | FileCheck %s
+
+; CHECK: ScratchSize: 0
+; CHECK: scratch_memory_size: 0
+define amdgpu_vs void @test() {
+.entry:
+  %0 = call i64 @llvm.amdgcn.s.getpc()
+  %1 = inttoptr i64 %0 to ptr
+  call amdgpu_gfx void %1()
+  ret void
+}
+
+declare i64 @llvm.amdgcn.s.getpc()
Index: llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
@@ -104,6 +104,7 @@
 
   MachineModuleInfo &MMI = getAnalysis<MachineModuleInfoWrapperPass>().getMMI();
   const TargetMachine &TM = TPC->getTM<TargetMachine>();
+  const MCSubtargetInfo &STI = *TM.getMCSubtargetInfo();
   bool HasIndirectCall = false;
 
   CallGraph CG = CallGraph(M);
@@ -111,7 +112,8 @@
 
   // By default, for code object v5 and later, track only the minimum scratch
   // size
-  if (AMDGPU::getCodeObjectVersion(M) >= AMDGPU::AMDHSA_COV5) {
+  if (AMDGPU::getCodeObjectVersion(M) >= AMDGPU::AMDHSA_COV5 ||
+      STI.getTargetTriple().getOS() == Triple::AMDPAL) {
     if (!AssumedStackSizeForDynamicSizeObjects.getNumOccurrences())
       AssumedStackSizeForDynamicSizeObjects = 0;
     if (!AssumedStackSizeForExternalCall.getNumOccurrences())


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150609.525325.patch
Type: text/x-patch
Size: 1570 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230524/78447a53/attachment.bin>


More information about the llvm-commits mailing list