Skip to content

Commit 74a8754

Browse files
authored
[flang][MLIR][OpenMP] make reduction by-ref toggled per variable (#92244)
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 6c7ec6e commit 74a8754

File tree

48 files changed

+464
-196
lines changed

Some content is hidden

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

48 files changed

+464
-196
lines changed

flang/lib/Lower/OpenMP/ClauseProcessor.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -917,20 +917,18 @@ bool ClauseProcessor::processReduction(
917917
llvm::SmallVectorImpl<const semantics::Symbol *> *outReductionSyms) const {
918918
return findRepeatableClause<omp::clause::Reduction>(
919919
[&](const omp::clause::Reduction &clause, const parser::CharBlock &) {
920-
// Use local lists of reductions to prevent variables from other
921-
// already-processed reduction clauses from impacting this reduction.
922-
// For example, the whole `reductionVars` array is queried to decide
923-
// whether to do the reduction byref.
924920
llvm::SmallVector<mlir::Value> reductionVars;
921+
llvm::SmallVector<bool> reduceVarByRef;
925922
llvm::SmallVector<mlir::Attribute> reductionDeclSymbols;
926923
llvm::SmallVector<const semantics::Symbol *> reductionSyms;
927924
ReductionProcessor rp;
928-
rp.addDeclareReduction(currentLocation, converter, clause,
929-
reductionVars, reductionDeclSymbols,
930-
outReductionSyms ? &reductionSyms : nullptr);
925+
rp.addDeclareReduction(
926+
currentLocation, converter, clause, reductionVars, reduceVarByRef,
927+
reductionDeclSymbols, outReductionSyms ? &reductionSyms : nullptr);
931928

932929
// Copy local lists into the output.
933930
llvm::copy(reductionVars, std::back_inserter(result.reductionVars));
931+
llvm::copy(reduceVarByRef, std::back_inserter(result.reduceVarByRef));
934932
llvm::copy(reductionDeclSymbols,
935933
std::back_inserter(result.reductionDeclSymbols));
936934

flang/lib/Lower/OpenMP/OpenMP.cpp

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

985985
if (processReduction) {
986986
cp.processReduction(loc, clauseOps, &reductionTypes, &reductionSyms);
987-
if (ReductionProcessor::doReductionByRef(clauseOps.reductionVars))
988-
clauseOps.reductionByRefAttr = converter.getFirOpBuilder().getUnitAttr();
989987
}
990988
}
991989

@@ -1173,17 +1171,13 @@ static void genWsloopClauses(
11731171
mlir::Location loc, mlir::omp::WsloopClauseOps &clauseOps,
11741172
llvm::SmallVectorImpl<mlir::Type> &reductionTypes,
11751173
llvm::SmallVectorImpl<const semantics::Symbol *> &reductionSyms) {
1176-
fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder();
11771174
ClauseProcessor cp(converter, semaCtx, clauses);
11781175
cp.processNowait(clauseOps);
11791176
cp.processOrdered(clauseOps);
11801177
cp.processReduction(loc, clauseOps, &reductionTypes, &reductionSyms);
11811178
cp.processSchedule(stmtCtx, clauseOps);
11821179
// TODO Support delayed privatization.
11831180

1184-
if (ReductionProcessor::doReductionByRef(clauseOps.reductionVars))
1185-
clauseOps.reductionByRefAttr = firOpBuilder.getUnitAttr();
1186-
11871181
cp.processTODO<clause::Allocate, clause::Linear, clause::Order>(
11881182
loc, llvm::omp::Directive::OMPD_do);
11891183
}

flang/lib/Lower/OpenMP/ReductionProcessor.cpp

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -657,32 +657,25 @@ 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

682674
void ReductionProcessor::addDeclareReduction(
683675
mlir::Location currentLocation, lower::AbstractConverter &converter,
684676
const omp::clause::Reduction &reduction,
685677
llvm::SmallVectorImpl<mlir::Value> &reductionVars,
678+
llvm::SmallVectorImpl<bool> &reduceVarByRef,
686679
llvm::SmallVectorImpl<mlir::Attribute> &reductionDeclSymbols,
687680
llvm::SmallVectorImpl<const semantics::Symbol *> *reductionSymbols) {
688681
fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder();
@@ -761,8 +754,8 @@ void ReductionProcessor::addDeclareReduction(
761754
"reduction input var is a reference");
762755

763756
reductionVars.push_back(symVal);
757+
reduceVarByRef.push_back(doReductionByRef(symVal));
764758
}
765-
const bool isByRef = doReductionByRef(reductionVars);
766759

767760
if (const auto &redDefinedOp =
768761
std::get_if<omp::clause::DefinedOperator>(&redOperator.u)) {
@@ -784,7 +777,7 @@ void ReductionProcessor::addDeclareReduction(
784777
break;
785778
}
786779

787-
for (mlir::Value symVal : reductionVars) {
780+
for (auto [symVal, isByRef] : llvm::zip(reductionVars, reduceVarByRef)) {
788781
auto redType = mlir::cast<fir::ReferenceType>(symVal.getType());
789782
const auto &kindMap = firOpBuilder.getKindMap();
790783
if (mlir::isa<fir::LogicalType>(redType.getEleTy()))
@@ -808,7 +801,7 @@ void ReductionProcessor::addDeclareReduction(
808801
*reductionIntrinsic)) {
809802
ReductionProcessor::ReductionIdentifier redId =
810803
ReductionProcessor::getReductionType(*reductionIntrinsic);
811-
for (mlir::Value symVal : reductionVars) {
804+
for (auto [symVal, isByRef] : llvm::zip(reductionVars, reduceVarByRef)) {
812805
auto redType = mlir::cast<fir::ReferenceType>(symVal.getType());
813806
if (!redType.getEleTy().isIntOrIndexOrFloat())
814807
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 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);
@@ -127,6 +124,7 @@ class ReductionProcessor {
127124
mlir::Location currentLocation, lower::AbstractConverter &converter,
128125
const omp::clause::Reduction &reduction,
129126
llvm::SmallVectorImpl<mlir::Value> &reductionVars,
127+
llvm::SmallVectorImpl<bool> &reduceVarByRef,
130128
llvm::SmallVectorImpl<mlir::Attribute> &reductionDeclSymbols,
131129
llvm::SmallVectorImpl<const semantics::Symbol *> *reductionSymbols =
132130
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)