[PATCH] D101534: [AMDGPU] Do not annotate features for graphics

Sebastian Neubauer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 3 01:34:17 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc0c8548b7068: [AMDGPU] Do not annotate features for graphics (authored by sebastian-ne).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101534

Files:
  llvm/lib/Target/AMDGPU/AMDGPUAnnotateKernelFeatures.cpp
  llvm/test/CodeGen/AMDGPU/pal-simple-indirect-call.ll


Index: llvm/test/CodeGen/AMDGPU/pal-simple-indirect-call.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/AMDGPU/pal-simple-indirect-call.ll
@@ -0,0 +1,36 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; Check that no attributes are added to graphics functions
+; RUN: opt -S -mtriple=amdgcn-amd-amdpal -amdgpu-annotate-kernel-features  %s | FileCheck -check-prefix=GCN %s
+
+; Check that it doesn't crash
+; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx1010 < %s | FileCheck -check-prefix=GFX9 %s
+
+target datalayout = "A5"
+
+define amdgpu_cs void @test_simple_indirect_call() {
+; GCN-LABEL: define amdgpu_cs void @test_simple_indirect_call() {
+; GFX9-LABEL: test_simple_indirect_call:
+; GFX9:       ; %bb.0:
+; GFX9-NEXT:    s_getpc_b64 s[36:37]
+; GFX9-NEXT:    s_mov_b32 s36, s0
+; GFX9-NEXT:    s_getpc_b64 s[4:5]
+; GFX9-NEXT:    s_load_dwordx4 s[36:39], s[36:37], 0x10
+; GFX9-NEXT:    s_mov_b32 s32, 0
+; GFX9-NEXT:    s_waitcnt lgkmcnt(0)
+; GFX9-NEXT:    s_add_u32 s36, s36, s0
+; GFX9-NEXT:    s_addc_u32 s37, s37, 0
+; GFX9-NEXT:    s_mov_b64 s[0:1], s[36:37]
+; GFX9-NEXT:    s_mov_b64 s[2:3], s[38:39]
+; GFX9-NEXT:    s_swappc_b64 s[30:31], s[4:5]
+; GFX9-NEXT:    s_endpgm
+
+  %pc = call i64 @llvm.amdgcn.s.getpc()
+  %fun = inttoptr i64 %pc to void()*
+  call amdgpu_gfx void %fun()
+  ret void
+}
+
+; Function Attrs: nounwind readnone speculatable willreturn
+declare i64 @llvm.amdgcn.s.getpc() #0
+
+attributes #0 = { nounwind readnone speculatable willreturn }
Index: llvm/lib/Target/AMDGPU/AMDGPUAnnotateKernelFeatures.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/AMDGPUAnnotateKernelFeatures.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUAnnotateKernelFeatures.cpp
@@ -403,9 +403,11 @@
     }
 
     Function *F = I->getFunction();
-    // Add feature attributes
-    if (!F || F->isDeclaration())
+    // Ignore functions with graphics calling conventions, these are currently
+    // not allowed to have kernel arguments.
+    if (!F || F->isDeclaration() || AMDGPU::isGraphics(F->getCallingConv()))
       continue;
+    // Add feature attributes
     Changed |= addFeatureAttributes(*F);
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101534.342327.patch
Type: text/x-patch
Size: 2267 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210503/de1e5814/attachment.bin>


More information about the llvm-commits mailing list