[clang] [llvm] [mlir] [OpenMP] Preserve host capture lifetimes in frontend lowering (PR #218453)

via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 1 04:51:37 PDT 2026


github-actions[bot] wrote:

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

* 154513 tests passed
* 3448 tests skipped
* 3 tests failed

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

### Flang
<details>
<summary>Flang.Integration/OpenMP/atomic-compare.f90</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 9
/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 -triple x86_64-unknown-linux-gnu -emit-llvm -fopenmp -fopenmp-version=51 /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Integration/OpenMP/atomic-compare.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/Integration/OpenMP/atomic-compare.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 -triple x86_64-unknown-linux-gnu -emit-llvm -fopenmp -fopenmp-version=51 /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Integration/OpenMP/atomic-compare.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/Integration/OpenMP/atomic-compare.f90
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Integration/OpenMP/atomic-compare.f90:417:14: error: CHECK-SAME: expected string not found in input
# | !CHECK-SAME: ptr noalias %{{.*}}, ptr noalias %{{.*}}, ptr %[[STRUCTARG:.*]])
# |              ^
# | <stdin>:392:73: note: scanning from here
# | define internal void @atomic_compare_capture_logical_parallel_..omp_par(ptr noalias %tid.addr, ptr noalias %zero.addr, ptr noalias nofreeobj %0) #0 {
# |                                                                         ^
# | <stdin>:392:73: note: pattern attempts to capture variables: "STRUCTARG"
# | define internal void @atomic_compare_capture_logical_parallel_..omp_par(ptr noalias %tid.addr, ptr noalias %zero.addr, ptr noalias nofreeobj %0) #0 {
# |                                                                         ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Integration/OpenMP/atomic-compare.f90
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             .
# |             .
# |             .
# |           387: omp.par.exit: ; preds = %omp_parallel 
# |           388:  ret void 
# |           389: } 
# |           390:  
# |           391: ; Function Attrs: nounwind 
# |           392: define internal void @atomic_compare_capture_logical_parallel_..omp_par(ptr noalias %tid.addr, ptr noalias %zero.addr, ptr noalias nofreeobj %0) #0 { 
# | same:417'0                                                                            {                                                                                search range start (exclusive)
# | same:417'1                                                                                                                                                             error: no match found in search range
# | same:417'2                                                                                                                                                             pattern attempts to capture variables: "STRUCTARG"
# |           393: omp.par.entry: 
# |           394:  %gep_ = getelementptr { ptr }, ptr %0, i32 0, i32 0 
# |           395:  %loadgep_ = load ptr, ptr %gep_, align 8, !align !3 
# |           396:  %tid.addr.local = alloca i32, align 4 
# |           397:  %1 = load i32, ptr %tid.addr, align 4 
# |             .
# |             .
# |             .
# |           465: !0 = !{i32 7, !"openmp", i32 51} 
# |           466: !1 = !{i32 2, !"Debug Info Version", i32 3} 
# |           467: !2 = !{!"flang version 24.0.0 (https://github.com/llvm/llvm-project cc59852cad9080711dad395159c73fa010f1f130)"} 
# |           468: !3 = !{i64 1} 
# |           469: !4 = !{!5} 
# |           470: !5 = !{i64 2, i64 -1, i64 -1, i1 true} 
# | same:417'3                                            } search range end (exclusive)
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>
<details>
<summary>Flang.Integration/OpenMP/parallel-reduction-mixed.f90</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 12
/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-llvm -fopenmp -o - /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Integration/OpenMP/parallel-reduction-mixed.f90 2>&1  | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Integration/OpenMP/parallel-reduction-mixed.f90 --check-prefixes=CHECK,POSIX
# 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-llvm -fopenmp -o - /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Integration/OpenMP/parallel-reduction-mixed.f90
# note: command had no output on stdout or stderr
# 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/Integration/OpenMP/parallel-reduction-mixed.f90 --check-prefixes=CHECK,POSIX
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Integration/OpenMP/parallel-reduction-mixed.f90:33:9: error: CHECK: expected string not found in input
# | !CHECK: %[[TID:.*]] = load i32, ptr %[[TID_ADDR]]
# |         ^
# | <stdin>:94:30: note: scanning from here
# |  %tid.addr.local = alloca i32, align 4
# |                              ^
# | <stdin>:94:30: note: with "TID_ADDR" equal to "zero.addr"
# |  %tid.addr.local = alloca i32, align 4
# |                              ^
# | <stdin>:94:30: note: pattern attempts to capture variables: "TID"
# |  %tid.addr.local = alloca i32, align 4
# |                              ^
# | <stdin>:97:2: note: possible intended match here
# |  %tid = load i32, ptr %tid.addr.local, align 4
# |  ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Integration/OpenMP/parallel-reduction-mixed.f90
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             .
# |             .
# |             .
# |            89:  %loadgep_ = load ptr, ptr %gep_, align 8, !align !3 
# |            90:  %gep_1 = getelementptr { ptr, ptr, ptr }, ptr %0, i32 0, i32 1 
# |            91:  %loadgep_2 = load ptr, ptr %gep_1, align 8, !align !3 
# |            92:  %gep_3 = getelementptr { ptr, ptr, ptr }, ptr %0, i32 0, i32 2 
# |            93:  %loadgep_4 = load ptr, ptr %gep_3, align 8, !align !4 
# |            94:  %tid.addr.local = alloca i32, align 4 
# | check:33'0                                 {            search range start (exclusive)
# | check:33'1                                              error: no match found in search range
# | check:33'2                                              with "TID_ADDR" equal to "zero.addr"
# | check:33'3                                              pattern attempts to capture variables: "TID"
# |            95:  %1 = load i32, ptr %tid.addr, align 4 
# |            96:  store i32 %1, ptr %tid.addr.local, align 4 
# |            97:  %tid = load i32, ptr %tid.addr.local, align 4 
# | check:33'4      ?                                               possible intended match
# |            98:  %omp.private.alloc = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8 
# |            99:  %2 = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, i64 1, align 8 
# |           100:  %3 = alloca ptr, align 8 
# |           101:  %4 = alloca i32, align 4 
# |           102:  %red.array = alloca [2 x ptr], align 8 
# |             .
# |             .
# |             .
# |           491: !1 = !{i32 2, !"Debug Info Version", i32 3} 
# |           492: !2 = !{!"flang version 24.0.0 (https://github.com/llvm/llvm-project cc59852cad9080711dad395159c73fa010f1f130)"} 
# |           493: !3 = !{i64 8} 
# |           494: !4 = !{i64 4} 
# |           495: !5 = !{!6} 
# |           496: !6 = !{i64 2, i64 -1, i64 -1, i1 true} 
# | check:33'5                                            } search range end (exclusive)
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>

### Clang
<details>
<summary>Clang.OpenMP/target_teams_generic_loop_codegen.cpp</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 4
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/24/include -nostdsysteminc -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -fopenmp-targets=amdgpu-amd-amdhsa -emit-llvm-bc /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/OpenMP/target_teams_generic_loop_codegen.cpp -o /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/OpenMP/Output/target_teams_generic_loop_codegen.cpp.tmp-ppc-host.bc
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/24/include -nostdsysteminc -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -fopenmp-targets=amdgpu-amd-amdhsa -emit-llvm-bc /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/OpenMP/target_teams_generic_loop_codegen.cpp -o /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/OpenMP/Output/target_teams_generic_loop_codegen.cpp.tmp-ppc-host.bc
# note: command had no output on stdout or stderr
# RUN: at line 5
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/24/include -nostdsysteminc -fopenmp -x c++ -std=c++11 -triple amdgpu-amd-amdhsa -fopenmp-targets=amdgpu-amd-amdhsa -emit-llvm /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/OpenMP/target_teams_generic_loop_codegen.cpp -fopenmp-is-target-device -fopenmp-host-ir-file-path /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/OpenMP/Output/target_teams_generic_loop_codegen.cpp.tmp-ppc-host.bc -o - | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck --allow-unused-prefixes /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/OpenMP/target_teams_generic_loop_codegen.cpp --check-prefix=IR-GPU
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/24/include -nostdsysteminc -fopenmp -x c++ -std=c++11 -triple amdgpu-amd-amdhsa -fopenmp-targets=amdgpu-amd-amdhsa -emit-llvm /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/OpenMP/target_teams_generic_loop_codegen.cpp -fopenmp-is-target-device -fopenmp-host-ir-file-path /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/OpenMP/Output/target_teams_generic_loop_codegen.cpp.tmp-ppc-host.bc -o -
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck --allow-unused-prefixes /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/OpenMP/target_teams_generic_loop_codegen.cpp --check-prefix=IR-GPU
# note: command had no output on stdout or stderr
# RUN: at line 7
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/24/include -nostdsysteminc -verify -triple x86_64-pc-linux-gnu -fopenmp -emit-llvm /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/OpenMP/target_teams_generic_loop_codegen.cpp -o - | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck --allow-unused-prefixes /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/OpenMP/target_teams_generic_loop_codegen.cpp --check-prefix=IR
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/24/include -nostdsysteminc -verify -triple x86_64-pc-linux-gnu -fopenmp -emit-llvm /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/OpenMP/target_teams_generic_loop_codegen.cpp -o -
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck --allow-unused-prefixes /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/OpenMP/target_teams_generic_loop_codegen.cpp --check-prefix=IR
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/OpenMP/target_teams_generic_loop_codegen.cpp:869:13: error: IR-SAME: expected string not found in input
# | // IR-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], i64 noundef [[DOTPREVIOUS_LB_:%.*]], i64 noundef [[DOTPREVIOUS_UB_:%.*]], i64 noundef [[J:%.*]], ptr noundef nonnull align 4 dereferenceable(400) [[SUM:%.*]]) #[[ATTR3:[0-9]+]] {
# |             ^
# | <stdin>:209:87: note: scanning from here
# | define internal void @__omp_offloading_ab_33ddbf__Z3foov_l22.omp_outlined.omp_outlined(ptr noalias noundef %.global_tid., ptr noalias noundef %.bound_tid., i64 noundef %.previous.lb., i64 noundef %.previous.ub., i64 noundef %j, ptr nofreeobj noundef nonnull align 4 dereferenceable(400) %sum) #3 {
# |                                                                                       ^
# | <stdin>:209:87: note: pattern attempts to capture variables: "ATTR3", "DOTBOUND_TID_", "DOTGLOBAL_TID_", "DOTPREVIOUS_LB_", "DOTPREVIOUS_UB_", "J", "SUM"
# | define internal void @__omp_offloading_ab_33ddbf__Z3foov_l22.omp_outlined.omp_outlined(ptr noalias noundef %.global_tid., ptr noalias noundef %.bound_tid., i64 noundef %.previous.lb., i64 noundef %.previous.ub., i64 noundef %j, ptr nofreeobj noundef nonnull align 4 dereferenceable(400) %sum) #3 {
# |                                                                                       ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/OpenMP/target_teams_generic_loop_codegen.cpp
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             .
# |             .
# |             .
# |           204:  
# |           205: ; Function Attrs: nounwind 
# |           206: declare void @__kmpc_for_static_init_4(ptr, i32, i32, ptr, ptr, ptr, ptr, i32, i32) #2 
# |           207:  
# |           208: ; Function Attrs: noinline nounwind optnone 
# |           209: define internal void @__omp_offloading_ab_33ddbf__Z3foov_l22.omp_outlined.omp_outlined(ptr noalias noundef %.global_tid., ptr noalias noundef %.bound_tid., i64 noundef %.previous.lb., i64 noundef %.previous.ub., i64 noundef %j, ptr nofreeobj noundef nonnull align 4 dereferenceable(400) %sum) #3 { 
# | same:869'0                                                                                          {                                                                                                                                                                                                                      search range start (exclusive)
# | same:869'1                                                                                                                                                                                                                                                                                                                 error: no match found in search range
# | same:869'2                                                                                                                                                                                                                                                                                                                 pattern attempts to capture variables: "ATTR3", "DOTBOUND_TID_", "DOTGLOBAL_TID_", "DOTPREVIOUS_LB_", "DOTPREVIOUS_UB_", "J", "SUM"
# |           210: entry: 
# |           211:  %.global_tid..addr = alloca ptr, align 8 
# |           212:  %.bound_tid..addr = alloca ptr, align 8 
# |           213:  %.previous.lb..addr = alloca i64, align 8 
# |           214:  %.previous.ub..addr = alloca i64, align 8 
# |             .
# |             .
# |             .
# |           391:  
# |           392: ; Function Attrs: nounwind 
# |           393: declare void @__kmpc_for_static_fini(ptr, i32) #2 
# |           394:  
# |           395: ; Function Attrs: noinline norecurse nounwind 
# |           396: define internal void @__omp_offloading_ab_33ddbf__Z3foov_l22.omp_outlined.omp_outlined.omp.reduction.reduction_func(ptr noundef %0, ptr noundef %1) #4 { 
# | same:869'3                                                                                                                        }                                       search range end (exclusive)
# |           397: entry: 
# |           398:  %.addr = alloca ptr, align 8 
# |           399:  %.addr1 = alloca ptr, align 8 
# |           400:  store ptr %0, ptr %.addr, align 8 
# |           401:  store ptr %1, ptr %.addr1, align 8 
# |             .
# |             .
# |             .
# | >>>>>>
# `-----------------------------
# 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/218453


More information about the llvm-commits mailing list