[flang-commits] [flang] [flang][OpenMP] Revert array element reduction lowering (PR #215617)

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Wed Aug 12 02:47:23 PDT 2026


================
@@ -1,4 +1,10 @@
-! RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=50 %s -o - | FileCheck %s --implicit-check-not=add_reduction_byref_box
+! RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=50 %s -o - | FileCheck %s --implicit-check-not=omp.reduction.element
+
+! Array-element reductions currently use the whole-array boxed reduction path.
+! Keep lowering coverage for these constructs so that this limitation does not
----------------
tblah wrote:

> The current RUN line does not test whether the array-element reduction constructs compile with `-c`. The test passes under `lit`, but the following command fails at `task_reduction_element`:
> 
> `flang -c -O0 -fopenmp -fopenmp-version=50 flang/test/Lower/OpenMP/reduction-array-element.f90`
> 
> Could we add a compile-stage RUN line?

It just fails because some of what we can lower isn't implemented yet in MLIR->LLVM IR translation. That is unchanged by this revert. I guess the difference is that now we work on whole arrays, more cases might trip the unimplemented by-ref case, but I don't think this is reason for blocking the revert. Support for those reductions remains partial. It is better to fail with a not yet implemented message than produce incorrect code.

I try to avoid adding too many integration tests because of the policy: https://github.com/llvm/llvm-project/blob/main/flang/test/Integration/README.md.

There are tests for the translation portion in mlir/test/Target/LLVMIR/*.mlir.

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


More information about the flang-commits mailing list