[PATCH] D153535: [AMDGPU][DAGISel] Be more flexible about what calls are allowed
Diana Picus via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 22 04:23:21 PDT 2023
rovka created this revision.
Herald added subscribers: foad, kerbowa, hiraditya, tpr, dstuttard, yaxunl, jvesely, kzhuravl, arsenm.
Herald added a project: All.
rovka requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.
Remove DAGISel checks on calling conventions. GlobalISel doesn't have
these checks either and we prefer it that way (see D152794 <https://reviews.llvm.org/D152794>).
Add a simple test like the one introduced in D117479 <https://reviews.llvm.org/D117479> for GlobalISel.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D153535
Files:
llvm/lib/Target/AMDGPU/SIISelLowering.cpp
llvm/test/CodeGen/AMDGPU/call-c-function.ll
llvm/test/CodeGen/AMDGPU/unsupported-calls.ll
Index: llvm/test/CodeGen/AMDGPU/unsupported-calls.ll
===================================================================
--- llvm/test/CodeGen/AMDGPU/unsupported-calls.ll
+++ llvm/test/CodeGen/AMDGPU/unsupported-calls.ll
@@ -62,7 +62,7 @@
ret i32 %call
}
-; GCN: :0:0: in function test_c_call_from_shader i32 (): unsupported calling convention for call from graphics shader of function defined_function
+; GCN-NOT: in function test_c_call_from_shader{{.*}}unsupported
; R600: in function test_c_call{{.*}}: unsupported call to function defined_function
define amdgpu_ps i32 @test_c_call_from_shader() {
%call = call i32 @defined_function(i32 0)
Index: llvm/test/CodeGen/AMDGPU/call-c-function.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/AMDGPU/call-c-function.ll
@@ -0,0 +1,13 @@
+; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
+; RUN: llc -global-isel=0 -stop-after=finalize-isel -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx900 -verify-machineinstrs -o - %s | FileCheck -enable-var-scope %s
+
+; Test that we don't explode on calls from shaders to functions with the C calling convention.
+
+define amdgpu_ps void @amdgpu_ps_call_default_cc() {
+ ; CHECK-LABEL: name: amdgpu_ps_call_default_cc
+ ; CHECK: bb.0.main_body:
+ ; CHECK-NEXT: S_ENDPGM 0
+main_body:
+ call void null()
+ ret void
+}
Index: llvm/lib/Target/AMDGPU/SIISelLowering.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/SIISelLowering.cpp
+++ llvm/lib/Target/AMDGPU/SIISelLowering.cpp
@@ -3198,21 +3198,6 @@
"unsupported required tail call to function ");
}
- if (AMDGPU::isShader(CallConv)) {
- // Note the issue is with the CC of the called function, not of the call
- // itself.
- return lowerUnhandledCall(CLI, InVals,
- "unsupported call to a shader function ");
- }
-
- if (AMDGPU::isShader(MF.getFunction().getCallingConv()) &&
- CallConv != CallingConv::AMDGPU_Gfx) {
- // Only allow calls with specific calling conventions.
- return lowerUnhandledCall(CLI, InVals,
- "unsupported calling convention for call from "
- "graphics shader of function ");
- }
-
if (IsTailCall) {
IsTailCall = isEligibleForTailCallOptimization(
Callee, CallConv, IsVarArg, Outs, OutVals, Ins, DAG);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153535.533556.patch
Type: text/x-patch
Size: 2470 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230622/ee8b550b/attachment.bin>
More information about the llvm-commits
mailing list