Skip to content

Commit 711809f

Browse files
authored
[flang][openacc/mp][NFC] Fix order of template arguments (#75538)
Some template parameters for the bounds ops generation have been inverted. It should be consistent to be `BoundsOp, BoundsType`.
1 parent 7fee58a commit 711809f

File tree

3 files changed

+24
-20
lines changed

3 files changed

+24
-20
lines changed

flang/lib/Lower/DirectivesCommon.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -885,7 +885,7 @@ mlir::Value gatherDataOperandAddrAndBounds(
885885

886886
if (!arrayElement->subscripts.empty()) {
887887
asFortran << '(';
888-
bounds = genBoundsOps<BoundsType, BoundsOp>(
888+
bounds = genBoundsOps<BoundsOp, BoundsType>(
889889
builder, operandLocation, converter, stmtCtx,
890890
arrayElement->subscripts, asFortran, dataExv, baseAddr,
891891
treatIndexAsSection);
@@ -898,7 +898,7 @@ mlir::Value gatherDataOperandAddrAndBounds(
898898
baseAddr = fir::getBase(compExv);
899899
if (fir::unwrapRefType(baseAddr.getType())
900900
.isa<fir::SequenceType>())
901-
bounds = genBaseBoundsOps<BoundsType, BoundsOp>(
901+
bounds = genBaseBoundsOps<BoundsOp, BoundsType>(
902902
builder, operandLocation, converter, compExv, baseAddr);
903903
asFortran << (*expr).AsFortran();
904904

@@ -917,7 +917,7 @@ mlir::Value gatherDataOperandAddrAndBounds(
917917
if (auto boxAddrOp = mlir::dyn_cast_or_null<fir::BoxAddrOp>(
918918
baseAddr.getDefiningOp())) {
919919
baseAddr = boxAddrOp.getVal();
920-
bounds = genBoundsOpsFromBox<BoundsType, BoundsOp>(
920+
bounds = genBoundsOpsFromBox<BoundsOp, BoundsType>(
921921
builder, operandLocation, converter, compExv, baseAddr);
922922
}
923923
} else {
@@ -944,11 +944,11 @@ mlir::Value gatherDataOperandAddrAndBounds(
944944
converter, builder, *name.symbol, operandLocation);
945945
if (fir::unwrapRefType(baseAddr.getType())
946946
.isa<fir::BaseBoxType>())
947-
bounds = genBoundsOpsFromBox<BoundsType, BoundsOp>(
947+
bounds = genBoundsOpsFromBox<BoundsOp, BoundsType>(
948948
builder, operandLocation, converter, dataExv, baseAddr);
949949
if (fir::unwrapRefType(baseAddr.getType())
950950
.isa<fir::SequenceType>())
951-
bounds = genBaseBoundsOps<BoundsType, BoundsOp>(
951+
bounds = genBaseBoundsOps<BoundsOp, BoundsType>(
952952
builder, operandLocation, converter, dataExv, baseAddr);
953953
asFortran << name.ToString();
954954
} else { // Unsupported

flang/lib/Lower/OpenACC.cpp

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,11 @@ genDataOperandOperations(const Fortran::parser::AccObjectList &objectList,
266266
std::stringstream asFortran;
267267
mlir::Location operandLocation = genOperandLocation(converter, accObject);
268268
mlir::Value baseAddr = Fortran::lower::gatherDataOperandAddrAndBounds<
269-
Fortran::parser::AccObject, mlir::acc::DataBoundsType,
270-
mlir::acc::DataBoundsOp>(converter, builder, semanticsContext, stmtCtx,
271-
accObject, operandLocation, asFortran, bounds,
272-
/*treatIndexAsSection=*/true);
269+
Fortran::parser::AccObject, mlir::acc::DataBoundsOp,
270+
mlir::acc::DataBoundsType>(converter, builder, semanticsContext,
271+
stmtCtx, accObject, operandLocation,
272+
asFortran, bounds,
273+
/*treatIndexAsSection=*/true);
273274
Op op = createDataEntryOp<Op>(builder, operandLocation, baseAddr, asFortran,
274275
bounds, structured, implicit, dataClause,
275276
baseAddr.getType());
@@ -291,9 +292,10 @@ static void genDeclareDataOperandOperations(
291292
std::stringstream asFortran;
292293
mlir::Location operandLocation = genOperandLocation(converter, accObject);
293294
mlir::Value baseAddr = Fortran::lower::gatherDataOperandAddrAndBounds<
294-
Fortran::parser::AccObject, mlir::acc::DataBoundsType,
295-
mlir::acc::DataBoundsOp>(converter, builder, semanticsContext, stmtCtx,
296-
accObject, operandLocation, asFortran, bounds);
295+
Fortran::parser::AccObject, mlir::acc::DataBoundsOp,
296+
mlir::acc::DataBoundsType>(converter, builder, semanticsContext,
297+
stmtCtx, accObject, operandLocation,
298+
asFortran, bounds);
297299
EntryOp op = createDataEntryOp<EntryOp>(
298300
builder, operandLocation, baseAddr, asFortran, bounds, structured,
299301
implicit, dataClause, baseAddr.getType());
@@ -748,9 +750,10 @@ genPrivatizations(const Fortran::parser::AccObjectList &objectList,
748750
std::stringstream asFortran;
749751
mlir::Location operandLocation = genOperandLocation(converter, accObject);
750752
mlir::Value baseAddr = Fortran::lower::gatherDataOperandAddrAndBounds<
751-
Fortran::parser::AccObject, mlir::acc::DataBoundsType,
752-
mlir::acc::DataBoundsOp>(converter, builder, semanticsContext, stmtCtx,
753-
accObject, operandLocation, asFortran, bounds);
753+
Fortran::parser::AccObject, mlir::acc::DataBoundsOp,
754+
mlir::acc::DataBoundsType>(converter, builder, semanticsContext,
755+
stmtCtx, accObject, operandLocation,
756+
asFortran, bounds);
754757

755758
RecipeOp recipe;
756759
mlir::Type retTy = getTypeFromBounds(bounds, baseAddr.getType());
@@ -1324,9 +1327,10 @@ genReductions(const Fortran::parser::AccObjectListWithReduction &objectList,
13241327
std::stringstream asFortran;
13251328
mlir::Location operandLocation = genOperandLocation(converter, accObject);
13261329
mlir::Value baseAddr = Fortran::lower::gatherDataOperandAddrAndBounds<
1327-
Fortran::parser::AccObject, mlir::acc::DataBoundsType,
1328-
mlir::acc::DataBoundsOp>(converter, builder, semanticsContext, stmtCtx,
1329-
accObject, operandLocation, asFortran, bounds);
1330+
Fortran::parser::AccObject, mlir::acc::DataBoundsOp,
1331+
mlir::acc::DataBoundsType>(converter, builder, semanticsContext,
1332+
stmtCtx, accObject, operandLocation,
1333+
asFortran, bounds);
13301334

13311335
mlir::Type reductionTy = fir::unwrapRefType(baseAddr.getType());
13321336
if (auto seqTy = mlir::dyn_cast<fir::SequenceType>(reductionTy))

flang/lib/Lower/OpenMP.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1794,8 +1794,8 @@ bool ClauseProcessor::processMap(
17941794
llvm::SmallVector<mlir::Value> bounds;
17951795
std::stringstream asFortran;
17961796
mlir::Value baseAddr = Fortran::lower::gatherDataOperandAddrAndBounds<
1797-
Fortran::parser::OmpObject, mlir::omp::DataBoundsType,
1798-
mlir::omp::DataBoundsOp>(
1797+
Fortran::parser::OmpObject, mlir::omp::DataBoundsOp,
1798+
mlir::omp::DataBoundsType>(
17991799
converter, firOpBuilder, semanticsContext, stmtCtx, ompObject,
18001800
clauseLocation, asFortran, bounds, treatIndexAsSection);
18011801

0 commit comments

Comments
 (0)