[AMDGPU][GlobalISel] Allow amdgpu_gfx calling conv
authorSebastian Neubauer <sebastian.neubauer@amd.com>
Wed, 26 May 2021 16:50:19 +0000 (18:50 +0200)
committerSebastian Neubauer <sebastian.neubauer@amd.com>
Thu, 27 May 2021 08:41:40 +0000 (10:41 +0200)
Calling functions from shaders already works with the SelectionDAG.

Differential Revision: https://reviews.llvm.org/D103183

llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp
llvm/test/CodeGen/AMDGPU/pal-simple-indirect-call.ll

index 0c9af9a..2a229af 100644 (file)
@@ -1252,19 +1252,13 @@ bool AMDGPUCallLowering::lowerCall(MachineIRBuilder &MIRBuilder,
   MachineRegisterInfo &MRI = MF.getRegInfo();
   const SITargetLowering &TLI = *getTLI<SITargetLowering>();
   const DataLayout &DL = F.getParent()->getDataLayout();
-  CallingConv::ID CallConv = F.getCallingConv();
 
   if (!AMDGPUTargetMachine::EnableFixedFunctionABI &&
-      CallConv != CallingConv::AMDGPU_Gfx) {
+      Info.CallConv != CallingConv::AMDGPU_Gfx) {
     LLVM_DEBUG(dbgs() << "Variable function ABI not implemented\n");
     return false;
   }
 
-  if (AMDGPU::isShader(CallConv)) {
-    LLVM_DEBUG(dbgs() << "Unhandled call from graphics shader\n");
-    return false;
-  }
-
   SmallVector<ArgInfo, 8> OutArgs;
   for (auto &OrigArg : Info.OrigArgs)
     splitToValueTypes(OrigArg, OutArgs, DL, Info.CallConv);
index 277fc9c..e5f0a1d 100644 (file)
@@ -5,6 +5,7 @@
 ; Check that it doesn't crash
 ; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx900 < %s | FileCheck -check-prefixes=GFX9 %s
 ; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx1010 < %s | FileCheck -check-prefixes=GFX10 %s
+; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx1010 -global-isel < %s | FileCheck -check-prefixes=GFX10 %s
 
 target datalayout = "A5"