[flang-commits] [flang] [llvm] [flang][OpenMP] Fix use_device_addr handling for COMMON blocks in target data (PR #217105)

via flang-commits flang-commits at lists.llvm.org
Tue Aug 25 06:48:38 PDT 2026


github-actions[bot] wrote:

<!--PREMERGE ADVISOR COMMENT: Linux-->
# :penguin: Linux x64 Test Results

* 4813 tests passed
* 137 tests skipped
* 1 test failed

## Failed Tests
(click on a test name to see its output)

### Flang
<details>
<summary>Flang.Lower/OpenMP/target-data-use-device-addr-common-block.f90</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/flang -fc1 -fintrinsic-modules-path=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/24/finclude/flang/x86_64-unknown-linux-gnu -emit-hlfir -fopenmp -fopenmp-version=51 /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Lower/OpenMP/target-data-use-device-addr-common-block.f90 -o - | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Lower/OpenMP/target-data-use-device-addr-common-block.f90
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/flang -fc1 -fintrinsic-modules-path=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/24/finclude/flang/x86_64-unknown-linux-gnu -emit-hlfir -fopenmp -fopenmp-version=51 /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Lower/OpenMP/target-data-use-device-addr-common-block.f90 -o -
# .---command stderr------------
# | warning: OpenMP support for version 51 in flang is still incomplete [-Wexperimental-option]
# `-----------------------------
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Lower/OpenMP/target-data-use-device-addr-common-block.f90
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Lower/OpenMP/target-data-use-device-addr-common-block.f90:5:10: error: CHECK: expected string not found in input
# | ! CHECK: %[[STANDALONE_X_MAP:.*]] = omp.map.info {{.*}} map_clauses(return_param) {{.*}} {name = "x"}
# |          ^
# | <stdin>:12:33: note: scanning from here
# |  func.func @_QPstandalone_common() {
# |                                 ^
# | <stdin>:12:33: note: pattern attempts to capture variables: "STANDALONE_X_MAP"
# |  func.func @_QPstandalone_common() {
# |                                 ^
# | <stdin>:23:25: note: possible intended match here
# |  %8 = omp.map.info var_ptr(%4#1 : !fir.ref<i32>, i32) map_clauses(return_param) capture(ByRef) name("x") -> !fir.ref<i32>
# |                         ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Lower/OpenMP/target-data-use-device-addr-common-block.f90:23:10: error: CHECK: expected string not found in input
# | ! CHECK: %[[CPTR_P_MAP:.*]] = omp.map.info {{.*}} map_clauses(return_param) {{.*}} {name = "p"}
# |          ^
# | <stdin>:36:31: note: scanning from here
# |  func.func @_QPall_cptr_common() {
# |                               ^
# | <stdin>:36:31: note: pattern attempts to capture variables: "CPTR_P_MAP"
# |  func.func @_QPall_cptr_common() {
# |                               ^
# | <stdin>:47:150: note: possible intended match here
# |  %8 = omp.map.info var_ptr(%4#1 : !fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>>, !fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>) map_clauses(return_param) capture(ByRef) name("p") -> !fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>>
# |                                                                                                                                                      ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Lower/OpenMP/target-data-use-device-addr-common-block.f90:41:10: error: CHECK: expected string not found in input
# | ! CHECK: %[[MIXED_P_MAP:.*]] = omp.map.info {{.*}} map_clauses(return_param) {{.*}} {name = "p"}
# |          ^
# | <stdin>:57:28: note: scanning from here
# |  func.func @_QPmixed_common() {
# |                            ^
# | <stdin>:57:28: note: pattern attempts to capture variables: "MIXED_P_MAP"
# |  func.func @_QPmixed_common() {
# |                            ^
# | <stdin>:69:25: note: possible intended match here
# |  %9 = omp.map.info var_ptr(%7#1 : !fir.ref<i32>, i32) map_clauses(return_param) capture(ByRef) name("x") -> !fir.ref<i32>
# |                         ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Lower/OpenMP/target-data-use-device-addr-common-block.f90:60:10: error: CHECK: expected string not found in input
# | ! CHECK: %[[MAPPED_MAP:.*]] = omp.map.info {{.*}} map_clauses(tofrom) {{.*}} {name = "mapped"}
# |          ^
# | <stdin>:81:29: note: scanning from here
# |  func.func @_QPmapped_common() {
# |                             ^
# | <stdin>:81:29: note: pattern attempts to capture variables: "MAPPED_MAP"
# |  func.func @_QPmapped_common() {
# |                             ^
# | <stdin>:92:57: note: possible intended match here
# |  %8 = omp.map.info var_ptr(%1 : !fir.ref<!fir.array<8xi8>>, !fir.array<8xi8>) map_clauses(tofrom) capture(ByRef) name("mapped") -> !fir.ref<!fir.array<8xi8>>
# |                                                         ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Lower/OpenMP/target-data-use-device-addr-common-block.f90:81:10: error: CHECK: expected string not found in input
# | ! CHECK: %[[EXPLICIT_X_MAP:.*]] = omp.map.info {{.*}} map_clauses(tofrom) {{.*}} {name = "x"}
# |          ^
# | <stdin>:111:35: note: scanning from here
# |  func.func @_QPexplicit_map_common() {
# |                                   ^
# | <stdin>:111:35: note: pattern attempts to capture variables: "EXPLICIT_X_MAP"
# |  func.func @_QPexplicit_map_common() {
# |                                   ^
# | <stdin>:122:25: note: possible intended match here
# |  %8 = omp.map.info var_ptr(%4#1 : !fir.ref<i32>, i32) map_clauses(tofrom) capture(ByRef) name("x") -> !fir.ref<i32>
# |                         ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Lower/OpenMP/target-data-use-device-addr-common-block.f90:99:10: error: CHECK: expected string not found in input
# | ! CHECK: %[[OUTER_MAP:.*]] = omp.map.info {{.*}} map_clauses(tofrom) {{.*}} {name = "outer_map"}
# |          ^
# | <stdin>:137:32: note: scanning from here
# |  func.func @_QPouter_map_common() {
# |                                ^
# | <stdin>:137:32: note: pattern attempts to capture variables: "OUTER_MAP"
# |  func.func @_QPouter_map_common() {
# |                                ^
# | <stdin>:148:57: note: possible intended match here
# |  %8 = omp.map.info var_ptr(%1 : !fir.ref<!fir.array<8xi8>>, !fir.array<8xi8>) map_clauses(tofrom) capture(ByRef) name("outer_map") -> !fir.ref<!fir.array<8xi8>>
# |                                                         ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Lower/OpenMP/target-data-use-device-addr-common-block.f90:119:10: error: CHECK: expected string not found in input
# | ! CHECK: %[[SECOND_R_MAP:.*]] = omp.map.info {{.*}} map_clauses(return_param) {{.*}} {name = "r"}
# |          ^
# | <stdin>:165:32: note: scanning from here
# |  func.func @_QPreordered_common(%arg0: !fir.ref<!fir.box<!fir.ptr<i32>>> {fir.bindc_name = "ptr"}) {
# |                                ^
# | <stdin>:165:32: note: pattern attempts to capture variables: "SECOND_R_MAP"
# |  func.func @_QPreordered_common(%arg0: !fir.ref<!fir.box<!fir.ptr<i32>>> {fir.bindc_name = "ptr"}) {
# |                                ^
# | <stdin>:186:29: note: possible intended match here
# |  %16 = omp.map.info var_ptr(%12#1 : !fir.ref<f32>, f32) map_clauses(return_param) capture(ByRef) name("r") -> !fir.ref<f32>
# |                             ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Lower/OpenMP/target-data-use-device-addr-common-block.f90
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |              .
# |              .
# |              .
# |              7:  fir.global common @nested_(dense<0> : vector<8xi8>) {alignment = 4 : i64} : !fir.array<8xi8> 
# |              8:  fir.global common @outer_map_(dense<0> : vector<8xi8>) {alignment = 4 : i64} : !fir.array<8xi8> 
# |              9:  fir.global common @second_(dense<0> : vector<8xi8>) {alignment = 4 : i64} : !fir.array<8xi8> 
# |             10:  fir.global common @standalone_(dense<0> : vector<8xi8>) {alignment = 4 : i64} : !fir.array<8xi8> 
# |             11:  fir.global common @unstructured_(dense<0> : vector<8xi8>) {alignment = 4 : i64} : !fir.array<8xi8> 
# |             12:  func.func @_QPstandalone_common() { 
# | check:5'0                                      {       search range start (exclusive)
# | check:5'1                                              error: no match found in search range
# | check:5'2                                              pattern attempts to capture variables: "STANDALONE_X_MAP"
# |             13:  %0 = fir.dummy_scope : !fir.dscope 
# |             14:  %1 = fir.address_of(@standalone_) : !fir.ref<!fir.array<8xi8>> 
# |             15:  %c0 = arith.constant 0 : index 
# |             16:  %2 = fir.coordinate_of %1, %c0 : (!fir.ref<!fir.array<8xi8>>, index) -> !fir.ref<i8> 
# |             17:  %3 = fir.convert %2 : (!fir.ref<i8>) -> !fir.ref<i32> 
# |             18:  %4:2 = hlfir.declare %3 storage(%1[0]) {uniq_name = "_QFstandalone_commonEx"} : (!fir.ref<i32>, !fir.ref<!fir.array<8xi8>>) -> (!fir.ref<i32>, !fir.ref<i32>) 
# |             19:  %c4 = arith.constant 4 : index 
# |             20:  %5 = fir.coordinate_of %1, %c4 : (!fir.ref<!fir.array<8xi8>>, index) -> !fir.ref<i8> 
# |             21:  %6 = fir.convert %5 : (!fir.ref<i8>) -> !fir.ref<i32> 
# |             22:  %7:2 = hlfir.declare %6 storage(%1[4]) {uniq_name = "_QFstandalone_commonEy"} : (!fir.ref<i32>, !fir.ref<!fir.array<8xi8>>) -> (!fir.ref<i32>, !fir.ref<i32>) 
# |             23:  %8 = omp.map.info var_ptr(%4#1 : !fir.ref<i32>, i32) map_clauses(return_param) capture(ByRef) name("x") -> !fir.ref<i32> 
# | check:5'3                               ?                                                                                                   possible intended match
# |             24:  %9 = omp.map.info var_ptr(%7#1 : !fir.ref<i32>, i32) map_clauses(return_param) capture(ByRef) name("y") -> !fir.ref<i32> 
# |             25:  omp.target_data use_device_addr(%8 -> %arg0, %9 -> %arg1 : !fir.ref<i32>, !fir.ref<i32>) { 
# |             26:  %10:2 = hlfir.declare %arg0 {uniq_name = "_QFstandalone_commonEx"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>) 
# |             27:  %11:2 = hlfir.declare %arg1 {uniq_name = "_QFstandalone_commonEy"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>) 
# |             28:  %12 = fir.load %11#0 : !fir.ref<i32> 
# |             29:  %c1_i32 = arith.constant 1 : i32 
# |             30:  %13 = arith.addi %12, %c1_i32 : i32 
# |             31:  hlfir.assign %13 to %10#0 : i32, !fir.ref<i32> 
# |             32:  omp.terminator 
# |             33:  } 
# |             34:  return 
# |             35:  } 
# |             36:  func.func @_QPall_cptr_common() { 
# | check:5'4                                     }      search range end (exclusive)
# | check:23'0                                   {       search range start (exclusive)
# | check:23'1                                           error: no match found in search range
# | check:23'2                                           pattern attempts to capture variables: "CPTR_P_MAP"
# |             37:  %0 = fir.dummy_scope : !fir.dscope 
# |             38:  %1 = fir.address_of(@all_cptr_) : !fir.ref<!fir.array<16xi8>> 
# |             39:  %c0 = arith.constant 0 : index 
# |             40:  %2 = fir.coordinate_of %1, %c0 : (!fir.ref<!fir.array<16xi8>>, index) -> !fir.ref<i8> 
# |             41:  %3 = fir.convert %2 : (!fir.ref<i8>) -> !fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>> 
# |             42:  %4:2 = hlfir.declare %3 storage(%1[0]) {uniq_name = "_QFall_cptr_commonEp"} : (!fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>>, !fir.ref<!fir.array<16xi8>>) -> (!fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>>, !fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>>) 
# |             43:  %c8 = arith
# | ...
# `---data was truncated (10240/27486) (change limit with -D output_limit=N)
# error: command failed with exit status: 1

--

```
</details>

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label.

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


More information about the flang-commits mailing list