[flang-commits] [flang] 5ada328 - [flang][OpenMP] ensure we hit the TODO for intrinsic array reduction (#90593)
via flang-commits
flang-commits at lists.llvm.org
Tue Apr 30 09:23:39 PDT 2024
Author: Tom Eccles
Date: 2024-04-30T17:23:35+01:00
New Revision: 5ada3289b107742929f2605aa4b2e3e903d4a690
URL: https://github.com/llvm/llvm-project/commit/5ada3289b107742929f2605aa4b2e3e903d4a690
DIFF: https://github.com/llvm/llvm-project/commit/5ada3289b107742929f2605aa4b2e3e903d4a690.diff
LOG: [flang][OpenMP] ensure we hit the TODO for intrinsic array reduction (#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.
Added:
flang/test/Lower/OpenMP/Todo/reduction-array-intrinsic.f90
Modified:
flang/lib/Lower/OpenMP/ReductionProcessor.cpp
Removed:
################################################################################
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