[flang-commits] [flang] [flang][OpenMP] ensure we hit the TODO for intrinsic array reduction (PR #90593)
Tom Eccles via flang-commits
flang-commits at lists.llvm.org
Tue Apr 30 04:16:10 PDT 2024
https://github.com/tblah created https://github.com/llvm/llvm-project/pull/90593
Before this patch we crashed lowering intrinsic array reductions.
I think this lost during a rebase. I've added a test to make sure it doesn't break again.
Also fixed the TODO message to be more accurate.
>From 7f2a1826191312da09fd22dbe24e7a6ef3e6a993 Mon Sep 17 00:00:00 2001
From: Tom Eccles <tom.eccles at arm.com>
Date: Tue, 30 Apr 2024 10:48:41 +0000
Subject: [PATCH] [flang][OpenMP] ensure we hit the TODO for intrinsic array
reduction
I think this lost during a rebase. I've added a test to make sure it
doesn't break again.
Also fixed the TODO message to be more accurate.
---
flang/lib/Lower/OpenMP/ReductionProcessor.cpp | 9 +++------
.../Lower/OpenMP/Todo/reduction-array-intrinsic.f90 | 11 +++++++++++
2 files changed, 14 insertions(+), 6 deletions(-)
create mode 100644 flang/test/Lower/OpenMP/Todo/reduction-array-intrinsic.f90
diff --git a/flang/lib/Lower/OpenMP/ReductionProcessor.cpp b/flang/lib/Lower/OpenMP/ReductionProcessor.cpp
index 38edd1b4682155..b3f08eb81c799a 100644
--- a/flang/lib/Lower/OpenMP/ReductionProcessor.cpp
+++ b/flang/lib/Lower/OpenMP/ReductionProcessor.cpp
@@ -811,14 +811,11 @@ void ReductionProcessor::addDeclareReduction(
*reductionIntrinsic)) {
ReductionProcessor::ReductionIdentifier redId =
ReductionProcessor::getReductionType(*reductionIntrinsic);
- for (const Object &object : objectList) {
- const Fortran::semantics::Symbol *symbol = object.id();
- mlir::Value symVal = converter.getSymbolAddress(*symbol);
- if (auto declOp = symVal.getDefiningOp<hlfir::DeclareOp>())
- symVal = declOp.getBase();
+ for (mlir::Value symVal : reductionVars) {
auto redType = mlir::cast<fir::ReferenceType>(symVal.getType());
if (!redType.getEleTy().isIntOrIndexOrFloat())
- TODO(currentLocation, "User Defined Reduction on non-trivial type");
+ TODO(currentLocation,
+ "Reduction of some types is not supported for intrinsics");
decl = createDeclareReduction(
firOpBuilder,
getReductionName(getRealName(*reductionIntrinsic).ToString(),
diff --git a/flang/test/Lower/OpenMP/Todo/reduction-array-intrinsic.f90 b/flang/test/Lower/OpenMP/Todo/reduction-array-intrinsic.f90
new file mode 100644
index 00000000000000..49c899238d2a37
--- /dev/null
+++ b/flang/test/Lower/OpenMP/Todo/reduction-array-intrinsic.f90
@@ -0,0 +1,11 @@
+! RUN: %not_todo_cmd bbc -emit-hlfir -fopenmp -o - %s 2>&1 | FileCheck %s
+! RUN: %not_todo_cmd %flang_fc1 -emit-hlfir -fopenmp -o - %s 2>&1 | FileCheck %s
+
+! CHECK: not yet implemented: Reduction of some types is not supported for intrinsics
+subroutine max_array_reduction(l, r)
+ integer :: l(:), r(:)
+
+ !$omp parallel reduction(max:l)
+ l = max(l, r)
+ !$omp end parallel
+end subroutine
More information about the flang-commits
mailing list