Skip to content

AMDGPU: Use reportFatalUsageError for unhandled calling conventions #145261

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

arsenm
Copy link
Contributor

@arsenm arsenm commented Jun 23, 2025

Should switch this to DiagnosticInfo and use the default calling
convention, but that would require passing in the context.

Should switch this to DiagnosticInfo and use the default calling
convention, but that would require passing in the context.
Copy link
Contributor Author

arsenm commented Jun 23, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@llvmbot
Copy link
Member

llvmbot commented Jun 23, 2025

@llvm/pr-subscribers-backend-amdgpu

Author: Matt Arsenault (arsenm)

Changes

Should switch this to DiagnosticInfo and use the default calling
convention, but that would require passing in the context.


Full diff: https://github.com/llvm/llvm-project/pull/145261.diff

4 Files Affected:

  • (modified) llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp (+2-2)
  • (modified) llvm/lib/Target/AMDGPU/R600ISelLowering.cpp (+1-1)
  • (added) llvm/test/CodeGen/AMDGPU/unsupported-calling-conv-call.ll (+7)
  • (added) llvm/test/CodeGen/AMDGPU/unsupported-calling-conv-func.ll (+6)
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp b/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
index 134adc681215f..3db2b3bff2d36 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
@@ -1142,7 +1142,7 @@ CCAssignFn *AMDGPUCallLowering::CCAssignFnForCall(CallingConv::ID CC,
   case CallingConv::AMDGPU_KERNEL:
   case CallingConv::SPIR_KERNEL:
   default:
-    report_fatal_error("Unsupported calling convention for call");
+    reportFatalUsageError("unsupported calling convention for call");
   }
 }
 
@@ -1169,7 +1169,7 @@ CCAssignFn *AMDGPUCallLowering::CCAssignFnForReturn(CallingConv::ID CC,
   case CallingConv::Cold:
     return RetCC_AMDGPU_Func;
   default:
-    report_fatal_error("Unsupported calling convention.");
+    reportFatalUsageError("unsupported calling convention");
   }
 }
 
diff --git a/llvm/lib/Target/AMDGPU/R600ISelLowering.cpp b/llvm/lib/Target/AMDGPU/R600ISelLowering.cpp
index 9c2811006bc1c..3c8bfa629ed3d 100644
--- a/llvm/lib/Target/AMDGPU/R600ISelLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/R600ISelLowering.cpp
@@ -1448,7 +1448,7 @@ CCAssignFn *R600TargetLowering::CCAssignFnForCall(CallingConv::ID CC,
   case CallingConv::AMDGPU_LS:
     return CC_R600;
   default:
-    report_fatal_error("Unsupported calling convention.");
+    reportFatalUsageError("unsupported calling convention");
   }
 }
 
diff --git a/llvm/test/CodeGen/AMDGPU/unsupported-calling-conv-call.ll b/llvm/test/CodeGen/AMDGPU/unsupported-calling-conv-call.ll
new file mode 100644
index 0000000000000..8824e8e1b3759
--- /dev/null
+++ b/llvm/test/CodeGen/AMDGPU/unsupported-calling-conv-call.ll
@@ -0,0 +1,7 @@
+; RUN: not llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -filetype=null %s 2>&1 | FileCheck %s
+
+; CHECK: LLVM ERROR: unsupported calling convention
+define void @caller(ptr %func) {
+  call aarch64_sve_vector_pcs void %func()
+  ret void
+}
diff --git a/llvm/test/CodeGen/AMDGPU/unsupported-calling-conv-func.ll b/llvm/test/CodeGen/AMDGPU/unsupported-calling-conv-func.ll
new file mode 100644
index 0000000000000..7ace7628a6e5b
--- /dev/null
+++ b/llvm/test/CodeGen/AMDGPU/unsupported-calling-conv-func.ll
@@ -0,0 +1,6 @@
+; RUN: not llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -filetype=null %s 2>&1 | FileCheck %s
+
+; CHECK: LLVM ERROR: unsupported calling convention
+define aarch64_sve_vector_pcs void @func() {
+  ret void
+}

@arsenm arsenm marked this pull request as ready for review June 23, 2025 04:56
@arsenm arsenm merged commit 4be4b82 into main Jun 23, 2025
11 checks passed
@arsenm arsenm deleted the users/arsenm/amdgpu/avoid-report-fatal-error-invalid-calling-conv branch June 23, 2025 06:30
miguelcsx pushed a commit to miguelcsx/llvm-project that referenced this pull request Jun 23, 2025
…lvm#145261)

Should switch this to DiagnosticInfo and use the default calling
convention, but that would require passing in the context.
Jaddyen pushed a commit to Jaddyen/llvm-project that referenced this pull request Jun 23, 2025
…lvm#145261)

Should switch this to DiagnosticInfo and use the default calling
convention, but that would require passing in the context.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants