Skip to content

Commit 57abf53

Browse files
committed
[flang][MLIR][OpenMP] make reduction by-ref toggled per variable
Fixes #88935 Toggling reduction by-ref broke when multiple reduction clauses were used. Decisions made for the by-ref status for later clauses could then invalidate decisions for earlier clauses. For example, ``` reduction(+:scalar,scalar2) reduction(+:array) ``` The first clause would choose by value reduction and generate by-value reduction regions, but then after this the second clause would force by-ref to support the array argument. But by the time the second clause is processed, the first clause has already had the wrong kind of reduction regions generated. This is solved by toggling whether a variable should be reduced by reference per variable. In the above example, this allows only `array` to be reduced by ref.
1 parent 041baf2 commit 57abf53

File tree

47 files changed

+441
-191
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+441
-191
lines changed

flang/lib/Lower/OpenMP/ClauseProcessor.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -933,20 +933,18 @@ bool ClauseProcessor::processReduction(
933933
return findRepeatableClause<omp::clause::Reduction>(
934934
[&](const omp::clause::Reduction &clause,
935935
const Fortran::parser::CharBlock &) {
936-
// Use local lists of reductions to prevent variables from other
937-
// already-processed reduction clauses from impacting this reduction.
938-
// For example, the whole `reductionVars` array is queried to decide
939-
// whether to do the reduction byref.
940936
llvm::SmallVector<mlir::Value> reductionVars;
937+
llvm::SmallVector<bool> reduceVarByRef;
941938
llvm::SmallVector<mlir::Attribute> reductionDeclSymbols;
942939
llvm::SmallVector<const Fortran::semantics::Symbol *> reductionSyms;
943940
ReductionProcessor rp;
944-
rp.addDeclareReduction(currentLocation, converter, clause,
945-
reductionVars, reductionDeclSymbols,
946-
outReductionSyms ? &reductionSyms : nullptr);
941+
rp.addDeclareReduction(
942+
currentLocation, converter, clause, reductionVars, reduceVarByRef,
943+
reductionDeclSymbols, outReductionSyms ? &reductionSyms : nullptr);
947944

948945
// Copy local lists into the output.
949946
llvm::copy(reductionVars, std::back_inserter(result.reductionVars));
947+
llvm::copy(reduceVarByRef, std::back_inserter(result.reduceVarByRef));
950948
llvm::copy(reductionDeclSymbols,
951949
std::back_inserter(result.reductionDeclSymbols));
952950

flang/lib/Lower/OpenMP/OpenMP.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,8 +1007,6 @@ static void genParallelClauses(
10071007

10081008
if (processReduction) {
10091009
cp.processReduction(loc, clauseOps, &reductionTypes, &reductionSyms);
1010-
if (ReductionProcessor::doReductionByRef(clauseOps.reductionVars))
1011-
clauseOps.reductionByRefAttr = converter.getFirOpBuilder().getUnitAttr();
10121010
}
10131011
}
10141012

@@ -1200,17 +1198,13 @@ static void genWsloopClauses(
12001198
mlir::Location loc, mlir::omp::WsloopClauseOps &clauseOps,
12011199
llvm::SmallVectorImpl<mlir::Type> &reductionTypes,
12021200
llvm::SmallVectorImpl<const Fortran::semantics::Symbol *> &reductionSyms) {
1203-
fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder();
12041201
ClauseProcessor cp(converter, semaCtx, clauses);
12051202
cp.processNowait(clauseOps);
12061203
cp.processOrdered(clauseOps);
12071204
cp.processReduction(loc, clauseOps, &reductionTypes, &reductionSyms);
12081205
cp.processSchedule(stmtCtx, clauseOps);
12091206
// TODO Support delayed privatization.
12101207

1211-
if (ReductionProcessor::doReductionByRef(clauseOps.reductionVars))
1212-
clauseOps.reductionByRefAttr = firOpBuilder.getUnitAttr();
1213-
12141208
cp.processTODO<clause::Allocate, clause::Linear, clause::Order>(
12151209
loc, llvm::omp::Directive::OMPD_do);
12161210
}

flang/lib/Lower/OpenMP/ReductionProcessor.cpp

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -657,25 +657,17 @@ mlir::omp::DeclareReductionOp ReductionProcessor::createDeclareReduction(
657657
return decl;
658658
}
659659

660-
// TODO: By-ref vs by-val reductions are currently toggled for the whole
661-
// operation (possibly effecting multiple reduction variables).
662-
// This could cause a problem with openmp target reductions because
663-
// by-ref trivial types may not be supported.
664-
bool ReductionProcessor::doReductionByRef(
665-
const llvm::SmallVectorImpl<mlir::Value> &reductionVars) {
666-
if (reductionVars.empty())
667-
return false;
660+
static bool doReductionByRef(mlir::Value reductionVar) {
668661
if (forceByrefReduction)
669662
return true;
670663

671-
for (mlir::Value reductionVar : reductionVars) {
672-
if (auto declare =
673-
mlir::dyn_cast<hlfir::DeclareOp>(reductionVar.getDefiningOp()))
674-
reductionVar = declare.getMemref();
664+
if (auto declare =
665+
mlir::dyn_cast<hlfir::DeclareOp>(reductionVar.getDefiningOp()))
666+
reductionVar = declare.getMemref();
667+
668+
if (!fir::isa_trivial(fir::unwrapRefType(reductionVar.getType())))
669+
return true;
675670

676-
if (!fir::isa_trivial(fir::unwrapRefType(reductionVar.getType())))
677-
return true;
678-
}
679671
return false;
680672
}
681673

@@ -684,6 +676,7 @@ void ReductionProcessor::addDeclareReduction(
684676
Fortran::lower::AbstractConverter &converter,
685677
const omp::clause::Reduction &reduction,
686678
llvm::SmallVectorImpl<mlir::Value> &reductionVars,
679+
llvm::SmallVectorImpl<bool> &reduceVarByRef,
687680
llvm::SmallVectorImpl<mlir::Attribute> &reductionDeclSymbols,
688681
llvm::SmallVectorImpl<const Fortran::semantics::Symbol *>
689682
*reductionSymbols) {
@@ -764,8 +757,8 @@ void ReductionProcessor::addDeclareReduction(
764757
"reduction input var is a reference");
765758

766759
reductionVars.push_back(symVal);
760+
reduceVarByRef.push_back(doReductionByRef(symVal));
767761
}
768-
const bool isByRef = doReductionByRef(reductionVars);
769762

770763
if (const auto &redDefinedOp =
771764
std::get_if<omp::clause::DefinedOperator>(&redOperator.u)) {
@@ -787,7 +780,7 @@ void ReductionProcessor::addDeclareReduction(
787780
break;
788781
}
789782

790-
for (mlir::Value symVal : reductionVars) {
783+
for (auto [symVal, isByRef] : llvm::zip(reductionVars, reduceVarByRef)) {
791784
auto redType = mlir::cast<fir::ReferenceType>(symVal.getType());
792785
const auto &kindMap = firOpBuilder.getKindMap();
793786
if (mlir::isa<fir::LogicalType>(redType.getEleTy()))
@@ -811,7 +804,7 @@ void ReductionProcessor::addDeclareReduction(
811804
*reductionIntrinsic)) {
812805
ReductionProcessor::ReductionIdentifier redId =
813806
ReductionProcessor::getReductionType(*reductionIntrinsic);
814-
for (mlir::Value symVal : reductionVars) {
807+
for (auto [symVal, isByRef] : llvm::zip(reductionVars, reduceVarByRef)) {
815808
auto redType = mlir::cast<fir::ReferenceType>(symVal.getType());
816809
if (!redType.getEleTy().isIntOrIndexOrFloat())
817810
TODO(currentLocation,

flang/lib/Lower/OpenMP/ReductionProcessor.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ class ReductionProcessor {
7373
static const Fortran::semantics::SourceName
7474
getRealName(const omp::clause::ProcedureDesignator &pd);
7575

76-
static bool
77-
doReductionByRef(const llvm::SmallVectorImpl<mlir::Value> &reductionVars);
78-
7976
static std::string getReductionName(llvm::StringRef name,
8077
const fir::KindMapping &kindMap,
8178
mlir::Type ty, bool isByRef);
@@ -128,6 +125,7 @@ class ReductionProcessor {
128125
Fortran::lower::AbstractConverter &converter,
129126
const omp::clause::Reduction &reduction,
130127
llvm::SmallVectorImpl<mlir::Value> &reductionVars,
128+
llvm::SmallVectorImpl<bool> &reduceVarByRef,
131129
llvm::SmallVectorImpl<mlir::Attribute> &reductionDeclSymbols,
132130
llvm::SmallVectorImpl<const Fortran::semantics::Symbol *>
133131
*reductionSymbols = nullptr);

flang/test/Fir/omp-reduction-embox-codegen.fir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ omp.declare_reduction @test_reduction : !fir.ref<!fir.box<i32>> init {
2525

2626
func.func @_QQmain() attributes {fir.bindc_name = "reduce"} {
2727
%4 = fir.alloca !fir.box<i32>
28-
omp.parallel byref reduction(@test_reduction %4 -> %arg0 : !fir.ref<!fir.box<i32>>) {
28+
omp.parallel reduction(byref @test_reduction %4 -> %arg0 : !fir.ref<!fir.box<i32>>) {
2929
omp.terminator
3030
}
3131
return

flang/test/Lower/OpenMP/default-clause-byref.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ subroutine skipped_default_clause_checks()
351351
type(it)::iii
352352

353353
!CHECK: omp.parallel {
354-
!CHECK: omp.wsloop byref reduction(@min_byref_i32 %[[VAL_Z_DECLARE]]#0 -> %[[PRV:.+]] : !fir.ref<i32>) {
354+
!CHECK: omp.wsloop reduction(byref @min_byref_i32 %[[VAL_Z_DECLARE]]#0 -> %[[PRV:.+]] : !fir.ref<i32>) {
355355
!CHECK-NEXT: omp.loop_nest (%[[ARG:.*]]) {{.*}} {
356356
!CHECK: omp.yield
357357
!CHECK: }

flang/test/Lower/OpenMP/delayed-privatization-reduction-byref.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ subroutine red_and_delayed_private
2626

2727
! CHECK-LABEL: _QPred_and_delayed_private
2828
! CHECK: omp.parallel
29-
! CHECK-SAME: reduction(@[[REDUCTION_SYM]] %{{.*}} -> %arg0 : !fir.ref<i32>)
29+
! CHECK-SAME: reduction(byref @[[REDUCTION_SYM]] %{{.*}} -> %arg0 : !fir.ref<i32>)
3030
! CHECK-SAME: private(@[[PRIVATIZER_SYM]] %{{.*}} -> %arg1 : !fir.ref<i32>) {

flang/test/Lower/OpenMP/parallel-reduction-add-byref.f90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
!CHECK: %[[I_DECL:.*]]:2 = hlfir.declare %[[IREF]] {uniq_name = "_QFsimple_int_addEi"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
4141
!CHECK: %[[I_START:.*]] = arith.constant 0 : i32
4242
!CHECK: hlfir.assign %[[I_START]] to %[[I_DECL]]#0 : i32, !fir.ref<i32>
43-
!CHECK: omp.parallel byref reduction(@[[RED_I32_NAME]] %[[I_DECL]]#0 -> %[[PRV:.+]] : !fir.ref<i32>) {
43+
!CHECK: omp.parallel reduction(byref @[[RED_I32_NAME]] %[[I_DECL]]#0 -> %[[PRV:.+]] : !fir.ref<i32>) {
4444
!CHECK: %[[P_DECL:.+]]:2 = hlfir.declare %[[PRV]] {{.*}} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
4545
!CHECK: %[[LPRV:.+]] = fir.load %[[P_DECL]]#0 : !fir.ref<i32>
4646
!CHECK: %[[I_INCR:.*]] = arith.constant 1 : i32
@@ -65,7 +65,7 @@ subroutine simple_int_add
6565
!CHECK: %[[R_DECL:.*]]:2 = hlfir.declare %[[RREF]] {uniq_name = "_QFsimple_real_addEr"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
6666
!CHECK: %[[R_START:.*]] = arith.constant 0.000000e+00 : f32
6767
!CHECK: hlfir.assign %[[R_START]] to %[[R_DECL]]#0 : f32, !fir.ref<f32>
68-
!CHECK: omp.parallel byref reduction(@[[RED_F32_NAME]] %[[R_DECL]]#0 -> %[[PRV:.+]] : !fir.ref<f32>) {
68+
!CHECK: omp.parallel reduction(byref @[[RED_F32_NAME]] %[[R_DECL]]#0 -> %[[PRV:.+]] : !fir.ref<f32>) {
6969
!CHECK: %[[P_DECL:.+]]:2 = hlfir.declare %[[PRV]] {{.*}} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
7070
!CHECK: %[[LPRV:.+]] = fir.load %[[P_DECL]]#0 : !fir.ref<f32>
7171
!CHECK: %[[R_INCR:.*]] = arith.constant 1.500000e+00 : f32
@@ -94,7 +94,7 @@ subroutine simple_real_add
9494
!CHECK: hlfir.assign %[[R_START]] to %[[R_DECL]]#0 : f32, !fir.ref<f32>
9595
!CHECK: %[[I_START:.*]] = arith.constant 0 : i32
9696
!CHECK: hlfir.assign %[[I_START]] to %[[I_DECL]]#0 : i32, !fir.ref<i32>
97-
!CHECK: omp.parallel byref reduction(@[[RED_I32_NAME]] %[[I_DECL]]#0 -> %[[IPRV:.+]] : !fir.ref<i32>, @[[RED_F32_NAME]] %[[R_DECL]]#0 -> %[[RPRV:.+]] : !fir.ref<f32>) {
97+
!CHECK: omp.parallel reduction(byref @[[RED_I32_NAME]] %[[I_DECL]]#0 -> %[[IPRV:.+]] : !fir.ref<i32>, byref @[[RED_F32_NAME]] %[[R_DECL]]#0 -> %[[RPRV:.+]] : !fir.ref<f32>) {
9898
!CHECK: %[[IP_DECL:.+]]:2 = hlfir.declare %[[IPRV]] {{.*}} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
9999
!CHECK: %[[RP_DECL:.+]]:2 = hlfir.declare %[[RPRV]] {{.*}} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
100100
!CHECK: %[[R_INCR:.*]] = arith.constant 1.500000e+00 : f32

flang/test/Lower/OpenMP/parallel-reduction-allocatable-array.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ program reduce
9595
! CHECK: %[[VAL_14:.*]] = arith.constant 0 : i32
9696
! CHECK: %[[VAL_15:.*]] = arith.constant 10 : i32
9797
! CHECK: %[[VAL_16:.*]] = arith.constant 1 : i32
98-
! CHECK: omp.wsloop byref reduction(@add_reduction_byref_box_heap_Uxi32 %[[VAL_3]]#0 -> %[[VAL_17:.*]] : !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>) {
98+
! CHECK: omp.wsloop reduction(byref @add_reduction_byref_box_heap_Uxi32 %[[VAL_3]]#0 -> %[[VAL_17:.*]] : !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>) {
9999
! CHECK-NEXT: omp.loop_nest (%[[VAL_18:.*]]) : i32 = (%[[VAL_14]]) to (%[[VAL_15]]) inclusive step (%[[VAL_16]]) {
100100
! CHECK: %[[VAL_19:.*]]:2 = hlfir.declare %[[VAL_17]] {fortran_attrs = {{.*}}<allocatable>, uniq_name = "_QFEr"} : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>) -> (!fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>, !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>)
101101
! CHECK: fir.store %[[VAL_18]] to %[[VAL_13]]#1 : !fir.ref<i32>

flang/test/Lower/OpenMP/parallel-reduction-array-lb.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ program reduce
7777
! CHECK: %[[VAL_6:.*]]:2 = hlfir.declare %[[VAL_0]](%[[VAL_5]]) {uniq_name = "_QFEi"} : (!fir.ref<!fir.array<3x2xi32>>, !fir.shapeshift<2>) -> (!fir.box<!fir.array<3x2xi32>>, !fir.ref<!fir.array<3x2xi32>>)
7878
! CHECK: %[[VAL_7:.*]] = fir.alloca !fir.box<!fir.array<3x2xi32>>
7979
! CHECK: fir.store %[[VAL_6]]#0 to %[[VAL_7]] : !fir.ref<!fir.box<!fir.array<3x2xi32>>>
80-
! CHECK: omp.parallel byref reduction(@add_reduction_byref_box_3x2xi32 %[[VAL_7]] -> %[[VAL_8:.*]] : !fir.ref<!fir.box<!fir.array<3x2xi32>>>) {
80+
! CHECK: omp.parallel reduction(byref @add_reduction_byref_box_3x2xi32 %[[VAL_7]] -> %[[VAL_8:.*]] : !fir.ref<!fir.box<!fir.array<3x2xi32>>>) {
8181
! CHECK: %[[VAL_9:.*]]:2 = hlfir.declare %[[VAL_8]] {uniq_name = "_QFEi"} : (!fir.ref<!fir.box<!fir.array<3x2xi32>>>) -> (!fir.ref<!fir.box<!fir.array<3x2xi32>>>, !fir.ref<!fir.box<!fir.array<3x2xi32>>>)
8282
! CHECK: %[[VAL_10:.*]] = arith.constant 3 : i32
8383
! CHECK: %[[VAL_11:.*]] = fir.load %[[VAL_9]]#0 : !fir.ref<!fir.box<!fir.array<3x2xi32>>>

flang/test/Lower/OpenMP/parallel-reduction-array.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ program reduce
7070
! CHECK: %[[VAL_4:.*]] = fir.embox %[[VAL_3]]#0(%[[VAL_2]]) : (!fir.ref<!fir.array<3xi32>>, !fir.shape<1>) -> !fir.box<!fir.array<3xi32>>
7171
! CHECK: %[[VAL_5:.*]] = fir.alloca !fir.box<!fir.array<3xi32>>
7272
! CHECK: fir.store %[[VAL_4]] to %[[VAL_5]] : !fir.ref<!fir.box<!fir.array<3xi32>>>
73-
! CHECK: omp.parallel byref reduction(@add_reduction_byref_box_3xi32 %[[VAL_5]] -> %[[VAL_6:.*]] : !fir.ref<!fir.box<!fir.array<3xi32>>>) {
73+
! CHECK: omp.parallel reduction(byref @add_reduction_byref_box_3xi32 %[[VAL_5]] -> %[[VAL_6:.*]] : !fir.ref<!fir.box<!fir.array<3xi32>>>) {
7474
! CHECK: %[[VAL_7:.*]]:2 = hlfir.declare %[[VAL_6]] {uniq_name = "_QFEi"} : (!fir.ref<!fir.box<!fir.array<3xi32>>>) -> (!fir.ref<!fir.box<!fir.array<3xi32>>>, !fir.ref<!fir.box<!fir.array<3xi32>>>)
7575
! CHECK: %[[VAL_8:.*]] = arith.constant 1 : i32
7676
! CHECK: %[[VAL_9:.*]] = fir.load %[[VAL_7]]#0 : !fir.ref<!fir.box<!fir.array<3xi32>>>

flang/test/Lower/OpenMP/parallel-reduction-array2.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ program reduce
6969
! CHECK: %[[VAL_4:.*]] = fir.embox %[[VAL_3]]#0(%[[VAL_2]]) : (!fir.ref<!fir.array<3xi32>>, !fir.shape<1>) -> !fir.box<!fir.array<3xi32>>
7070
! CHECK: %[[VAL_5:.*]] = fir.alloca !fir.box<!fir.array<3xi32>>
7171
! CHECK: fir.store %[[VAL_4]] to %[[VAL_5]] : !fir.ref<!fir.box<!fir.array<3xi32>>>
72-
! CHECK: omp.parallel byref reduction(@add_reduction_byref_box_3xi32 %[[VAL_5]] -> %[[VAL_6:.*]] : !fir.ref<!fir.box<!fir.array<3xi32>>>) {
72+
! CHECK: omp.parallel reduction(byref @add_reduction_byref_box_3xi32 %[[VAL_5]] -> %[[VAL_6:.*]] : !fir.ref<!fir.box<!fir.array<3xi32>>>) {
7373
! CHECK: %[[VAL_7:.*]]:2 = hlfir.declare %[[VAL_6]] {uniq_name = "_QFEi"} : (!fir.ref<!fir.box<!fir.array<3xi32>>>) -> (!fir.ref<!fir.box<!fir.array<3xi32>>>, !fir.ref<!fir.box<!fir.array<3xi32>>>)
7474
! CHECK: %[[VAL_8:.*]] = fir.load %[[VAL_7]]#0 : !fir.ref<!fir.box<!fir.array<3xi32>>>
7575
! CHECK: %[[VAL_9:.*]] = arith.constant 1 : index

flang/test/Lower/OpenMP/parallel-reduction-byref.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
!CHECK: %[[RED_ACCUM_DECL:[_a-z0-9]+]]:2 = hlfir.declare %[[RED_ACCUM_REF]] {uniq_name = "_QFEi"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
2222
!CHECK: %[[C0:[_a-z0-9]+]] = arith.constant 0 : i32
2323
!CHECK: hlfir.assign %[[C0]] to %[[RED_ACCUM_DECL]]#0 : i32, !fir.ref<i32>
24-
!CHECK: omp.parallel byref reduction(@[[REDUCTION_DECLARE]] %[[RED_ACCUM_DECL]]#0 -> %[[PRIVATE_RED:[a-z0-9]+]] : !fir.ref<i32>) {
24+
!CHECK: omp.parallel reduction(byref @[[REDUCTION_DECLARE]] %[[RED_ACCUM_DECL]]#0 -> %[[PRIVATE_RED:[a-z0-9]+]] : !fir.ref<i32>) {
2525
!CHECK: %[[PRIVATE_DECL:[_a-z0-9]+]]:2 = hlfir.declare %[[PRIVATE_RED]] {uniq_name = "_QFEi"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
2626
!CHECK: %[[C1:[_a-z0-9]+]] = arith.constant 1 : i32
2727
!CHECK: hlfir.assign %[[C1]] to %[[PRIVATE_DECL]]#0 : i32, !fir.ref<i32>

flang/test/Lower/OpenMP/parallel-reduction3.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
! CHECK: %[[VAL_18:.*]] = arith.constant 1 : i32
7575
! CHECK: %[[VAL_19:.*]] = fir.alloca !fir.box<!fir.array<?xi32>>
7676
! CHECK: fir.store %[[VAL_12]]#0 to %[[VAL_19]] : !fir.ref<!fir.box<!fir.array<?xi32>>>
77-
! CHECK: omp.wsloop byref reduction(@add_reduction_byref_box_Uxi32 %[[VAL_19]] -> %[[VAL_20:.*]] : !fir.ref<!fir.box<!fir.array<?xi32>>>) {
77+
! CHECK: omp.wsloop reduction(byref @add_reduction_byref_box_Uxi32 %[[VAL_19]] -> %[[VAL_20:.*]] : !fir.ref<!fir.box<!fir.array<?xi32>>>) {
7878
! CHECK-NEXT: omp.loop_nest (%[[VAL_21:.*]]) : i32 = (%[[VAL_16]]) to (%[[VAL_17]]) inclusive step (%[[VAL_18]]) {
7979
! CHECK: %[[VAL_22:.*]]:2 = hlfir.declare %[[VAL_20]] {uniq_name = "_QFsEc"} : (!fir.ref<!fir.box<!fir.array<?xi32>>>) -> (!fir.ref<!fir.box<!fir.array<?xi32>>>, !fir.ref<!fir.box<!fir.array<?xi32>>>)
8080
! CHECK: fir.store %[[VAL_21]] to %[[VAL_15]]#1 : !fir.ref<i32>

flang/test/Lower/OpenMP/parallel-wsloop-reduction-byref.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
! RUN: flang-new -fc1 -fopenmp -mmlir --force-byref-reduction -emit-hlfir %s -o - | FileCheck %s
55

66
! CHECK: omp.parallel {
7-
! CHECK: omp.wsloop byref reduction(@add_reduction_byref_i32
7+
! CHECK: omp.wsloop reduction(byref @add_reduction_byref_i32
88
subroutine sb
99
integer :: x
1010
x = 0

0 commit comments

Comments
 (0)