[llvm] AMDGPU: Use reportFatalUsageError for unsupported code object version (PR #145133)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 20 19:05:44 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/145133.diff


2 Files Affected:

- (modified) llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp (+1-1) 
- (added) llvm/test/CodeGen/AMDGPU/unsupported-hsa-code-object-version.ll (+12) 


``````````diff
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
index 84b0f98554097..9513b7b2aef26 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
@@ -350,7 +350,7 @@ bool AMDGPUAsmPrinter::doInitialization(Module &M) {
       HSAMetadataStream = std::make_unique<HSAMD::MetadataStreamerMsgPackV6>();
       break;
     default:
-      report_fatal_error("Unexpected code object version");
+      reportFatalUsageError("unsupported code object version");
     }
   }
 
diff --git a/llvm/test/CodeGen/AMDGPU/unsupported-hsa-code-object-version.ll b/llvm/test/CodeGen/AMDGPU/unsupported-hsa-code-object-version.ll
new file mode 100644
index 0000000000000..7eab565a431ad
--- /dev/null
+++ b/llvm/test/CodeGen/AMDGPU/unsupported-hsa-code-object-version.ll
@@ -0,0 +1,12 @@
+; RUN: not llc -filetype=asm -mtriple=amdgcn-amd-amdhsa -mcpu=gfx801 -o /dev/null %s 2>&1 | FileCheck %s
+; RUN: not llc -filetype=obj -mtriple=amdgcn-amd-amdhsa -mcpu=gfx801 -o /dev/null %s 2>&1 | FileCheck %s
+; RUN: not llc -filetype=null -mtriple=amdgcn-amd-amdhsa -mcpu=gfx801 -o /dev/null %s 2>&1 | FileCheck %s
+
+; CHECK: LLVM ERROR: unsupported code object version
+define amdgpu_kernel void @kernel() {
+  ret void
+}
+
+!llvm.module.flags = !{!0}
+
+!0 = !{i32 1, !"amdhsa_code_object_version", i32 0}

``````````

</details>


https://github.com/llvm/llvm-project/pull/145133


More information about the llvm-commits mailing list