[llvm] AMDGPU: Avoid report_fatal_error for unsupported ds_ordered_count (PR #145172)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 21 08:11:46 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-amdgpu
Author: Matt Arsenault (arsenm)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/145172.diff
2 Files Affected:
- (modified) llvm/lib/Target/AMDGPU/SIInstrInfo.cpp (+6-2)
- (added) llvm/test/CodeGen/AMDGPU/llvm.amdgcn.ds.ordered.add-unsupported.ll (+22)
``````````diff
diff --git a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
index a538ec9df6f03..7c17b932fa469 100644
--- a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
@@ -10101,8 +10101,12 @@ unsigned SIInstrInfo::getDSShaderTypeValue(const MachineFunction &MF) {
return 3;
case CallingConv::AMDGPU_HS:
case CallingConv::AMDGPU_LS:
- case CallingConv::AMDGPU_ES:
- report_fatal_error("ds_ordered_count unsupported for this calling conv");
+ case CallingConv::AMDGPU_ES: {
+ const Function &F = MF.getFunction();
+ F.getContext().diagnose(DiagnosticInfoUnsupported(
+ F, "ds_ordered_count unsupported for this calling conv"));
+ [[fallthrough]];
+ }
case CallingConv::AMDGPU_CS:
case CallingConv::AMDGPU_KERNEL:
case CallingConv::C:
diff --git a/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.ds.ordered.add-unsupported.ll b/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.ds.ordered.add-unsupported.ll
new file mode 100644
index 0000000000000..20da8d651c0ef
--- /dev/null
+++ b/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.ds.ordered.add-unsupported.ll
@@ -0,0 +1,22 @@
+; RUN: not llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx900 -filetype=null 2>&1 %s | FileCheck %s
+
+; CHECK: error: <unknown>:0:0: in function ds_ordered_add_amdgpu_hs void (ptr addrspace(2), ptr addrspace(1)): ds_ordered_count unsupported for this calling conv
+define amdgpu_hs void @ds_ordered_add_amdgpu_hs(ptr addrspace(2) inreg %gds, ptr addrspace(1) %out) {
+ %val = call i32 @llvm.amdgcn.ds.ordered.add(ptr addrspace(2) %gds, i32 31, i32 0, i32 0, i1 false, i32 1, i1 true, i1 true)
+ store i32 %val, ptr addrspace(1) %out
+ ret void
+}
+
+; CHECK: error: <unknown>:0:0: in function ds_ordered_add_amdgpu_ls void (ptr addrspace(2), ptr addrspace(1)): ds_ordered_count unsupported for this calling conv
+define amdgpu_ls void @ds_ordered_add_amdgpu_ls(ptr addrspace(2) inreg %gds, ptr addrspace(1) %out) {
+ %val = call i32 @llvm.amdgcn.ds.ordered.add(ptr addrspace(2) %gds, i32 31, i32 0, i32 0, i1 false, i32 1, i1 true, i1 true)
+ store i32 %val, ptr addrspace(1) %out
+ ret void
+}
+
+; CHECK: error: <unknown>:0:0: in function ds_ordered_add_amdgpu_es void (ptr addrspace(2), ptr addrspace(1)): ds_ordered_count unsupported for this calling conv
+define amdgpu_es void @ds_ordered_add_amdgpu_es(ptr addrspace(2) inreg %gds, ptr addrspace(1) %out) {
+ %val = call i32 @llvm.amdgcn.ds.ordered.add(ptr addrspace(2) %gds, i32 31, i32 0, i32 0, i1 false, i32 1, i1 true, i1 true)
+ store i32 %val, ptr addrspace(1) %out
+ ret void
+}
``````````
</details>
https://github.com/llvm/llvm-project/pull/145172
More information about the llvm-commits
mailing list