From a723771e43547f8a3ab616bf0f817230fe783e1f Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Sat, 21 Jun 2025 11:03:19 +0900 Subject: [PATCH] AMDGPU: Use reportFatalUsageError for unsupported code object version --- llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp | 2 +- .../CodeGen/AMDGPU/unsupported-code-object-version.ll | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) 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(); break; default: - report_fatal_error("Unexpected code object version"); + reportFatalUsageError("unsupported code object version"); } } diff --git a/llvm/test/CodeGen/AMDGPU/unsupported-code-object-version.ll b/llvm/test/CodeGen/AMDGPU/unsupported-code-object-version.ll index da7bc3a85d73f..f389254183666 100644 --- a/llvm/test/CodeGen/AMDGPU/unsupported-code-object-version.ll +++ b/llvm/test/CodeGen/AMDGPU/unsupported-code-object-version.ll @@ -1,8 +1,10 @@ -; RUN: sed 's/CODE_OBJECT_VERSION/0/g' %s | not --crash llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx906 2>&1 | FileCheck --check-prefix=HSA-ERROR %s -; RUN: sed 's/CODE_OBJECT_VERSION/100/g' %s | not --crash llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx906 2>&1 | FileCheck --check-prefix=HSA-ERROR %s -; RUN: sed 's/CODE_OBJECT_VERSION/9900/g' %s | not --crash llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx906 2>&1 | FileCheck --check-prefix=HSA-ERROR %s +; RUN: sed 's/CODE_OBJECT_VERSION/0/g' %s | not llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx906 2>&1 | FileCheck --check-prefix=HSA-ERROR %s +; RUN: sed 's/CODE_OBJECT_VERSION/100/g' %s | not llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx906 2>&1 | FileCheck --check-prefix=HSA-ERROR %s +; RUN: sed 's/CODE_OBJECT_VERSION/9900/g' %s | not llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx906 2>&1 | FileCheck --check-prefix=HSA-ERROR %s +; RUN: sed 's/CODE_OBJECT_VERSION/0/g' %s | not llc -filetype=obj -mtriple=amdgcn-amd-amdhsa -mcpu=gfx906 2>&1 | FileCheck --check-prefix=HSA-ERROR %s +; RUN: sed 's/CODE_OBJECT_VERSION/0/g' %s | not llc -filetype=asm -mtriple=amdgcn-amd-amdhsa -mcpu=gfx906 2>&1 | FileCheck --check-prefix=HSA-ERROR %s -; HSA-ERROR: Unexpected code object version +; HSA-ERROR: unsupported code object version !llvm.module.flags = !{!0} !0 = !{i32 1, !"amdhsa_code_object_version", i32 CODE_OBJECT_VERSION}