[llvm] [Offload] Use llvm::Error throughout liboffload internals (PR #140879)

Michał Górny via llvm-commits llvm-commits at lists.llvm.org
Wed May 28 09:02:49 PDT 2025


mgorny wrote:

This change seems to have introduced test failures for me:

```
FAIL: libomptarget :: x86_64-unknown-linux-gnu :: tools/offload-tblgen/default_returns.td (314 of 716)
******************** TEST 'libomptarget :: x86_64-unknown-linux-gnu :: tools/offload-tblgen/default_returns.td' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload_build/offload-tblgen -gen-api -I /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload/test/tools/offload-tblgen/../../../liboffload/API /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload/test/tools/offload-tblgen/default_returns.td | /usr/lib/llvm/21/bin/FileCheck /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload/test/tools/offload-tblgen/default_returns.td --check-prefix=CHECK-API
# executed command: /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload_build/offload-tblgen -gen-api -I /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload/test/tools/offload-tblgen/../../../liboffload/API /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload/test/tools/offload-tblgen/default_returns.td
# executed command: /usr/lib/llvm/21/bin/FileCheck /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload/test/tools/offload-tblgen/default_returns.td --check-prefix=CHECK-API
# RUN: at line 2
/var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload_build/offload-tblgen -gen-entry-points -I /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload/test/tools/offload-tblgen/../../../liboffload/API /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload/test/tools/offload-tblgen/default_returns.td | /usr/lib/llvm/21/bin/FileCheck /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload/test/tools/offload-tblgen/default_returns.td --check-prefix=CHECK-VALIDATION
# executed command: /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload_build/offload-tblgen -gen-entry-points -I /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload/test/tools/offload-tblgen/../../../liboffload/API /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload/test/tools/offload-tblgen/default_returns.td
# executed command: /usr/lib/llvm/21/bin/FileCheck /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload/test/tools/offload-tblgen/default_returns.td --check-prefix=CHECK-VALIDATION
# .---command stderr------------
# | /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload/test/tools/offload-tblgen/default_returns.td:37:27: error: CHECK-VALIDATION-NEXT: expected string not found in input
# | // CHECK-VALIDATION-NEXT: return OL_ERRC_INVALID_NULL_HANDLE;
# |                           ^
# | <stdin>:13:26: note: scanning from here
# |  if (NULL == ParamHandle) {
# |                          ^
# | <stdin>:14:31: note: possible intended match here
# |  return createOffloadError(error::ErrorCode::INVALID_NULL_HANDLE, "validation failure: NULL == ParamHandle");
# |                               ^
# | 
# | Input file: <stdin>
# | Check file: /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload/test/tools/offload-tblgen/default_returns.td
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |            .
# |            .
# |            .
# |            8:  
# |            9: /////////////////////////////////////////////////////////////////////////////// 
# |           10: llvm::Error FunctionA_val( 
# |           11:  uint32_t ParamValue, ol_foo_handle_t ParamHandle, uint32_t* ParamPointer, uint32_t* ParamPointerOpt) { 
# |           12:  if (offloadConfig().ValidationEnabled) { 
# |           13:  if (NULL == ParamHandle) { 
# | next:37'0                              X~~ error: no match found
# |           14:  return createOffloadError(error::ErrorCode::INVALID_NULL_HANDLE, "validation failure: NULL == ParamHandle"); 
# | next:37'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | next:37'1                                   ?                                                                                possible intended match
# |           15:  } 
# | next:37'0     ~~~
# |           16:  
# | next:37'0     ~
# |           17:  if (NULL == ParamPointer) { 
# | next:37'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           18:  return createOffloadError(error::ErrorCode::INVALID_NULL_POINTER, "validation failure: NULL == ParamPointer"); 
# | next:37'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           19:  } 
# | next:37'0     ~~~
# |            .
# |            .
# |            .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

********************
FAIL: libomptarget :: x86_64-unknown-linux-gnu :: tools/offload-tblgen/entry_points.td (315 of 716)
******************** TEST 'libomptarget :: x86_64-unknown-linux-gnu :: tools/offload-tblgen/entry_points.td' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload_build/offload-tblgen -gen-entry-points -I /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload/test/tools/offload-tblgen/../../../liboffload/API /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload/test/tools/offload-tblgen/entry_points.td | /usr/lib/llvm/21/bin/FileCheck /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload/test/tools/offload-tblgen/entry_points.td
# executed command: /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload_build/offload-tblgen -gen-entry-points -I /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload/test/tools/offload-tblgen/../../../liboffload/API /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload/test/tools/offload-tblgen/entry_points.td
# executed command: /usr/lib/llvm/21/bin/FileCheck /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload/test/tools/offload-tblgen/entry_points.td
# .---command stderr------------
# | /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload/test/tools/offload-tblgen/entry_points.td:31:11: error: CHECK: expected string not found in input
# | // CHECK: Result = FunctionA_val(ParamA, ParamB);
# |           ^
# | <stdin>:25:35: note: scanning from here
# |  llvm::errs() << "---> FunctionA";
# |                                   ^
# | <stdin>:43:14: note: possible intended match here
# |  ol_result_t Result = ::FunctionA(ParamA, ParamB);
# |              ^
# | 
# | Input file: <stdin>
# | Check file: /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload/test/tools/offload-tblgen/entry_points.td
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             .
# |             .
# |             .
# |            20:  
# |            21: } 
# |            22: OL_APIEXPORT ol_result_t OL_APICALL FunctionA( 
# |            23:  uint32_t ParamA, uint32_t* ParamB) { 
# |            24:  if (offloadConfig().TracingEnabled) { 
# |            25:  llvm::errs() << "---> FunctionA"; 
# | check:31'0                                       X error: no match found
# |            26:  } 
# | check:31'0     ~~~
# |            27:  
# | check:31'0     ~
# |            28:  ol_result_t Result = llvmErrorToOffloadError(FunctionA_val(ParamA, ParamB)); 
# | check:31'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            29:  
# | check:31'0     ~
# |            30:  if (offloadConfig().TracingEnabled) { 
# | check:31'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             .
# |             .
# |             .
# |            38:  return Result; 
# | check:31'0     ~~~~~~~~~~~~~~~~
# |            39: } 
# | check:31'0     ~~
# |            40: ol_result_t FunctionAWithCodeLoc( 
# | check:31'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            41:  uint32_t ParamA, uint32_t* ParamB, ol_code_location_t *CodeLocation) { 
# | check:31'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            42:  currentCodeLocation() = CodeLocation; 
# | check:31'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            43:  ol_result_t Result = ::FunctionA(ParamA, ParamB); 
# | check:31'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | check:31'1                  ?                                      possible intended match
# |            44:  
# | check:31'0     ~
# |            45:  currentCodeLocation() = nullptr; 
# | check:31'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            46:  return Result; 
# | check:31'0     ~~~~~~~~~~~~~~~~
# |            47: } 
# | check:31'0     ~~
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

********************
```

(and same in the "LTO" test variants)

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


More information about the llvm-commits mailing list