[flang-commits] [flang] [flang][openacc] Lower loop directive to the new acc.loop op design (PR #65417)
Valentin Clement バレンタイン クレメン via flang-commits
flang-commits at lists.llvm.org
Thu Sep 7 11:03:01 PDT 2023
https://github.com/clementval updated https://github.com/llvm/llvm-project/pull/65417:
>From 0e5204d6533b0bff1666cdc737bba138e60516e5 Mon Sep 17 00:00:00 2001
From: Valentin Clement <clementval at gmail.com>
Date: Fri, 1 Sep 2023 11:10:59 -0700
Subject: [PATCH 1/4] [flang][openacc] Lower loop directive to the new acc.loop
op design
acc.loop was redesigned in https://reviews.llvm.org/D159229. This patch
updates the lowering to match the new op.
DO CONCURRENT construct will be added in a follow up patch.
---
flang/include/flang/Lower/OpenACC.h | 5 +
flang/lib/Lower/Bridge.cpp | 21 +-
flang/lib/Lower/OpenACC.cpp | 142 ++++++++++--
flang/test/Lower/OpenACC/acc-kernels-loop.f90 | 154 +++++--------
flang/test/Lower/OpenACC/acc-loop.f90 | 208 ++++++++----------
.../test/Lower/OpenACC/acc-parallel-loop.f90 | 180 ++++++---------
flang/test/Lower/OpenACC/acc-private.f90 | 6 +-
flang/test/Lower/OpenACC/acc-reduction.f90 | 48 ++--
flang/test/Lower/OpenACC/acc-serial-loop.f90 | 140 ++++--------
9 files changed, 430 insertions(+), 474 deletions(-)
diff --git a/flang/include/flang/Lower/OpenACC.h b/flang/include/flang/Lower/OpenACC.h
index 447d5c43cad805..0ad52bda787526 100644
--- a/flang/include/flang/Lower/OpenACC.h
+++ b/flang/include/flang/Lower/OpenACC.h
@@ -35,6 +35,7 @@ class FirOpBuilder;
namespace Fortran {
namespace parser {
+struct AccClauseList;
struct OpenACCConstruct;
struct OpenACCDeclarativeConstruct;
} // namespace parser
@@ -63,6 +64,8 @@ static constexpr llvm::StringRef declarePreDeallocSuffix =
static constexpr llvm::StringRef declarePostDeallocSuffix =
"_acc_declare_update_desc_post_dealloc";
+static constexpr llvm::StringRef privatizationRecipePrefix = "privatization";
+
void genOpenACCConstruct(AbstractConverter &,
Fortran::semantics::SemanticsContext &,
pft::Evaluation &, const parser::OpenACCConstruct &);
@@ -103,6 +106,8 @@ void attachDeclarePreDeallocAction(AbstractConverter &, fir::FirOpBuilder &,
void attachDeclarePostDeallocAction(AbstractConverter &, fir::FirOpBuilder &,
const Fortran::semantics::Symbol &);
+int64_t getCollapseValue(const Fortran::parser::AccClauseList &);
+
} // namespace lower
} // namespace Fortran
diff --git a/flang/lib/Lower/Bridge.cpp b/flang/lib/Lower/Bridge.cpp
index bf66d2402eb9b6..835be3c3de6c1a 100644
--- a/flang/lib/Lower/Bridge.cpp
+++ b/flang/lib/Lower/Bridge.cpp
@@ -2245,9 +2245,28 @@ class FirConverter : public Fortran::lower::AbstractConverter {
void genFIR(const Fortran::parser::OpenACCConstruct &acc) {
mlir::OpBuilder::InsertPoint insertPt = builder->saveInsertionPoint();
+ localSymbols.pushScope();
genOpenACCConstruct(*this, bridge.getSemanticsContext(), getEval(), acc);
- for (Fortran::lower::pft::Evaluation &e : getEval().getNestedEvaluations())
+
+ const Fortran::parser::OpenACCLoopConstruct *accLoop =
+ std::get_if<Fortran::parser::OpenACCLoopConstruct>(&acc.u);
+
+ Fortran::lower::pft::Evaluation *curEval = &getEval();
+
+ if (accLoop) {
+ const Fortran::parser::AccBeginLoopDirective &beginLoopDir =
+ std::get<Fortran::parser::AccBeginLoopDirective>(accLoop->t);
+ const Fortran::parser::AccClauseList &clauseList =
+ std::get<Fortran::parser::AccClauseList>(beginLoopDir.t);
+ int64_t collapseValue = Fortran::lower::getCollapseValue(clauseList);
+ curEval = &curEval->getFirstNestedEvaluation();
+ for (int64_t i = 1; i < collapseValue; i++)
+ curEval = &*std::next(curEval->getNestedEvaluations().begin());
+ }
+
+ for (Fortran::lower::pft::Evaluation &e : curEval->getNestedEvaluations())
genFIR(e);
+ localSymbols.popScope();
builder->restoreInsertionPoint(insertPt);
}
diff --git a/flang/lib/Lower/OpenACC.cpp b/flang/lib/Lower/OpenACC.cpp
index 5ec04722cd5e11..a0b884e6ba7e6b 100644
--- a/flang/lib/Lower/OpenACC.cpp
+++ b/flang/lib/Lower/OpenACC.cpp
@@ -803,7 +803,8 @@ genPrivatizations(const Fortran::parser::AccObjectList &objectList,
mlir::Type retTy = getTypeFromBounds(bounds, baseAddr.getType());
if constexpr (std::is_same_v<RecipeOp, mlir::acc::PrivateRecipeOp>) {
std::string recipeName =
- fir::getTypeAsString(retTy, converter.getKindMap(), "privatization");
+ fir::getTypeAsString(retTy, converter.getKindMap(),
+ Fortran::lower::privatizationRecipePrefix);
recipe = Fortran::lower::createOrGetPrivateRecipe(builder, recipeName,
operandLocation, retTy);
auto op = createDataEntryOp<mlir::acc::PrivateOp>(
@@ -1249,13 +1250,14 @@ static void addOperand(llvm::SmallVectorImpl<mlir::Value> &operands,
}
template <typename Op, typename Terminator>
-static Op
-createRegionOp(fir::FirOpBuilder &builder, mlir::Location loc,
- const llvm::SmallVectorImpl<mlir::Value> &operands,
- const llvm::SmallVectorImpl<int32_t> &operandSegments) {
- llvm::ArrayRef<mlir::Type> argTy;
- Op op = builder.create<Op>(loc, argTy, operands);
- builder.createBlock(&op.getRegion());
+static Op createRegionOp(fir::FirOpBuilder &builder, mlir::Location loc,
+ const llvm::SmallVectorImpl<mlir::Value> &operands,
+ const llvm::SmallVectorImpl<int32_t> &operandSegments,
+ mlir::TypeRange argsTy = {},
+ llvm::SmallVector<mlir::Location> locs = {}) {
+ llvm::ArrayRef<mlir::Type> retTy;
+ Op op = builder.create<Op>(loc, retTy, operands);
+ builder.createBlock(&op.getRegion(), op.getRegion().end(), argsTy, locs);
mlir::Block &block = op.getRegion().back();
builder.setInsertionPointToStart(&block);
builder.create<Terminator>(loc);
@@ -1343,11 +1345,21 @@ static void genWaitClause(Fortran::lower::AbstractConverter &converter,
}
}
+mlir::Type getTypeFromIvTypeSize(fir::FirOpBuilder &builder,
+ const Fortran::semantics::Symbol &ivSym) {
+ std::size_t ivTypeSize = ivSym.size();
+ if (ivTypeSize == 0)
+ llvm::report_fatal_error("unexpected induction variable size");
+ return builder.getIntegerType(ivTypeSize * 8);
+}
+
static mlir::acc::LoopOp
createLoopOp(Fortran::lower::AbstractConverter &converter,
mlir::Location currentLocation,
Fortran::semantics::SemanticsContext &semanticsContext,
Fortran::lower::StatementContext &stmtCtx,
+ const Fortran::parser::DoConstruct &outerDoConstruct,
+ Fortran::lower::pft::Evaluation &eval,
const Fortran::parser::AccClauseList &accClauseList) {
fir::FirOpBuilder &builder = converter.getFirOpBuilder();
@@ -1356,11 +1368,73 @@ createLoopOp(Fortran::lower::AbstractConverter &converter,
mlir::Value gangNum;
mlir::Value gangDim;
mlir::Value gangStatic;
- llvm::SmallVector<mlir::Value, 2> tileOperands, privateOperands,
- reductionOperands;
+ llvm::SmallVector<mlir::Value> tileOperands, privateOperands, ivPrivate,
+ reductionOperands, lowerbounds, upperbounds, steps;
llvm::SmallVector<mlir::Attribute> privatizations, reductionRecipes;
+
bool hasGang = false, hasVector = false, hasWorker = false;
+ llvm::SmallVector<mlir::Type> ivTypes;
+ llvm::SmallVector<mlir::Location> ivLocs;
+ llvm::SmallVector<bool> inclusiveBounds;
+
+ if (outerDoConstruct.IsDoConcurrent())
+ TODO(currentLocation, "OpenACC loop with DO CONCURRENT");
+
+ int64_t collapseValue = Fortran::lower::getCollapseValue(accClauseList);
+ Fortran::lower::pft::Evaluation *crtEval = &eval.getFirstNestedEvaluation();
+ for (unsigned i = 0; i < collapseValue; ++i) {
+ const Fortran::parser::LoopControl *loopControl;
+ if (i == 0) {
+ loopControl = &*outerDoConstruct.GetLoopControl();
+ } else {
+ auto *doCons = crtEval->getIf<Fortran::parser::DoConstruct>();
+ assert(doCons && "expect do construct");
+ loopControl = &*doCons->GetLoopControl();
+ }
+
+ const Fortran::parser::LoopControl::Bounds *bounds =
+ std::get_if<Fortran::parser::LoopControl::Bounds>(&loopControl->u);
+ assert(bounds && "Expected bounds on the loop construct");
+ lowerbounds.push_back(fir::getBase(converter.genExprValue(
+ *Fortran::semantics::GetExpr(bounds->lower), stmtCtx)));
+ upperbounds.push_back(fir::getBase(converter.genExprValue(
+ *Fortran::semantics::GetExpr(bounds->upper), stmtCtx)));
+ if (bounds->step)
+ steps.push_back(fir::getBase(converter.genExprValue(
+ *Fortran::semantics::GetExpr(bounds->step), stmtCtx)));
+ else // If `step` is not present, assume it as `1`.
+ steps.push_back(builder.createIntegerConstant(
+ currentLocation, builder.getIntegerType(32), 1));
+
+ Fortran::semantics::Symbol &ivSym =
+ bounds->name.thing.symbol->GetUltimate();
+
+ mlir::Type ivTy = getTypeFromIvTypeSize(builder, ivSym);
+ mlir::Value ivValue = converter.getSymbolAddress(ivSym);
+ ivTypes.push_back(ivTy);
+ ivLocs.push_back(currentLocation);
+ std::string recipeName =
+ fir::getTypeAsString(ivValue.getType(), converter.getKindMap(),
+ Fortran::lower::privatizationRecipePrefix);
+ auto recipe = Fortran::lower::createOrGetPrivateRecipe(
+ builder, recipeName, currentLocation, ivValue.getType());
+ std::stringstream asFortran;
+ auto op = createDataEntryOp<mlir::acc::PrivateOp>(
+ builder, currentLocation, ivValue, asFortran, {}, true,
+ /*implicit=*/true, mlir::acc::DataClause::acc_private,
+ ivValue.getType());
+
+ privateOperands.push_back(op.getAccPtr());
+ ivPrivate.push_back(op.getAccPtr());
+ privatizations.push_back(mlir::SymbolRefAttr::get(
+ builder.getContext(), recipe.getSymName().str()));
+ inclusiveBounds.push_back(true);
+ converter.bindSymbol(ivSym, op.getAccPtr());
+ if (i < collapseValue - 1)
+ crtEval = &*std::next(crtEval->getNestedEvaluations().begin());
+ }
+
for (const Fortran::parser::AccClause &clause : accClauseList.v) {
mlir::Location clauseLocation = converter.genLocation(clause.source);
if (const auto *gangClause =
@@ -1443,6 +1517,9 @@ createLoopOp(Fortran::lower::AbstractConverter &converter,
// Prepare the operand segment size attribute and the operands value range.
llvm::SmallVector<mlir::Value> operands;
llvm::SmallVector<int32_t> operandSegments;
+ addOperands(operands, operandSegments, lowerbounds);
+ addOperands(operands, operandSegments, upperbounds);
+ addOperands(operands, operandSegments, steps);
addOperand(operands, operandSegments, gangNum);
addOperand(operands, operandSegments, gangDim);
addOperand(operands, operandSegments, gangStatic);
@@ -1453,7 +1530,13 @@ createLoopOp(Fortran::lower::AbstractConverter &converter,
addOperands(operands, operandSegments, reductionOperands);
auto loopOp = createRegionOp<mlir::acc::LoopOp, mlir::acc::YieldOp>(
- builder, currentLocation, operands, operandSegments);
+ builder, currentLocation, operands, operandSegments, ivTypes, ivLocs);
+
+ builder.create<fir::StoreOp>(currentLocation,
+ loopOp.getLoopBody().front().getArguments()[0],
+ ivPrivate[0]);
+
+ loopOp.setInclusiveUpperbound(inclusiveBounds);
if (hasGang)
loopOp.setHasGangAttr(builder.getUnitAttr());
@@ -1514,12 +1597,15 @@ static void genACC(Fortran::lower::AbstractConverter &converter,
converter.genLocation(beginLoopDirective.source);
Fortran::lower::StatementContext stmtCtx;
- if (loopDirective.v == llvm::acc::ACCD_loop) {
- const auto &accClauseList =
- std::get<Fortran::parser::AccClauseList>(beginLoopDirective.t);
- createLoopOp(converter, currentLocation, semanticsContext, stmtCtx,
- accClauseList);
- }
+ if (loopDirective.v != llvm::acc::ACCD_loop)
+ llvm::report_fatal_error("Unsupported OpenACC loop construct");
+
+ const auto &accClauseList =
+ std::get<Fortran::parser::AccClauseList>(beginLoopDirective.t);
+ const auto &outerDoConstruct =
+ std::get<Fortran::parser::DoConstruct>(loopConstruct.t);
+ createLoopOp(converter, currentLocation, semanticsContext, stmtCtx,
+ outerDoConstruct, eval, accClauseList);
}
template <typename Op, typename Clause>
@@ -2066,6 +2152,9 @@ genACC(Fortran::lower::AbstractConverter &converter,
std::get<Fortran::parser::AccCombinedDirective>(beginCombinedDirective.t);
const auto &accClauseList =
std::get<Fortran::parser::AccClauseList>(beginCombinedDirective.t);
+ const auto &outerDoConstruct =
+ std::get<std::optional<Fortran::parser::DoConstruct>>(
+ combinedConstruct.t);
mlir::Location currentLocation =
converter.genLocation(beginCombinedDirective.source);
@@ -2075,17 +2164,17 @@ genACC(Fortran::lower::AbstractConverter &converter,
createComputeOp<mlir::acc::KernelsOp>(
converter, currentLocation, semanticsContext, stmtCtx, accClauseList);
createLoopOp(converter, currentLocation, semanticsContext, stmtCtx,
- accClauseList);
+ *outerDoConstruct, eval, accClauseList);
} else if (combinedDirective.v == llvm::acc::ACCD_parallel_loop) {
createComputeOp<mlir::acc::ParallelOp>(
converter, currentLocation, semanticsContext, stmtCtx, accClauseList);
createLoopOp(converter, currentLocation, semanticsContext, stmtCtx,
- accClauseList);
+ *outerDoConstruct, eval, accClauseList);
} else if (combinedDirective.v == llvm::acc::ACCD_serial_loop) {
createComputeOp<mlir::acc::SerialOp>(
converter, currentLocation, semanticsContext, stmtCtx, accClauseList);
createLoopOp(converter, currentLocation, semanticsContext, stmtCtx,
- accClauseList);
+ *outerDoConstruct, eval, accClauseList);
} else {
llvm::report_fatal_error("Unknown combined construct encountered");
}
@@ -3216,3 +3305,16 @@ void Fortran::lower::attachDeclarePostDeallocAction(
/*preAlloc=*/{}, /*postAlloc=*/{}, /*preDealloc=*/{},
/*postDealloc=*/builder.getSymbolRefAttr(fctName.str())));
}
+
+int64_t Fortran::lower::getCollapseValue(
+ const Fortran::parser::AccClauseList &clauseList) {
+ for (const Fortran::parser::AccClause &clause : clauseList.v) {
+ if (const auto *collapseClause =
+ std::get_if<Fortran::parser::AccClause::Collapse>(&clause.u)) {
+ const parser::AccCollapseArg &arg = collapseClause->v;
+ const auto &collapseValue{std::get<parser::ScalarIntConstantExpr>(arg.t)};
+ return *Fortran::semantics::GetIntValue(collapseValue);
+ }
+ }
+ return 1;
+}
diff --git a/flang/test/Lower/OpenACC/acc-kernels-loop.f90 b/flang/test/Lower/OpenACC/acc-kernels-loop.f90
index 05cd5ffe5f692f..99d2621daf5be9 100644
--- a/flang/test/Lower/OpenACC/acc-kernels-loop.f90
+++ b/flang/test/Lower/OpenACC/acc-kernels-loop.f90
@@ -37,8 +37,7 @@ subroutine acc_kernels_loop
END DO
! CHECK: acc.kernels {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -51,8 +50,7 @@ subroutine acc_kernels_loop
!$acc end kernels loop
! CHECK: acc.kernels {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -65,8 +63,7 @@ subroutine acc_kernels_loop
! CHECK: [[ASYNC1:%.*]] = arith.constant 1 : i32
! CHECK: acc.kernels async([[ASYNC1]] : i32) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -79,8 +76,7 @@ subroutine acc_kernels_loop
! CHECK: [[ASYNC2:%.*]] = fir.load %{{.*}} : !fir.ref<i32>
! CHECK: acc.kernels async([[ASYNC2]] : i32) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -92,8 +88,7 @@ subroutine acc_kernels_loop
END DO
! CHECK: acc.kernels {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -106,8 +101,7 @@ subroutine acc_kernels_loop
! CHECK: [[WAIT1:%.*]] = arith.constant 1 : i32
! CHECK: acc.kernels wait([[WAIT1]] : i32) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -121,8 +115,7 @@ subroutine acc_kernels_loop
! CHECK: [[WAIT2:%.*]] = arith.constant 1 : i32
! CHECK: [[WAIT3:%.*]] = arith.constant 2 : i32
! CHECK: acc.kernels wait([[WAIT2]], [[WAIT3]] : i32, i32) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -136,8 +129,7 @@ subroutine acc_kernels_loop
! CHECK: [[WAIT4:%.*]] = fir.load %{{.*}} : !fir.ref<i32>
! CHECK: [[WAIT5:%.*]] = fir.load %{{.*}} : !fir.ref<i32>
! CHECK: acc.kernels wait([[WAIT4]], [[WAIT5]] : i32, i32) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -150,8 +142,7 @@ subroutine acc_kernels_loop
! CHECK: [[NUMGANGS1:%.*]] = arith.constant 1 : i32
! CHECK: acc.kernels num_gangs([[NUMGANGS1]] : i32) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -164,8 +155,7 @@ subroutine acc_kernels_loop
! CHECK: [[NUMGANGS2:%.*]] = fir.load %{{.*}} : !fir.ref<i32>
! CHECK: acc.kernels num_gangs([[NUMGANGS2]] : i32) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -178,8 +168,7 @@ subroutine acc_kernels_loop
! CHECK: [[NUMWORKERS1:%.*]] = arith.constant 10 : i32
! CHECK: acc.kernels num_workers([[NUMWORKERS1]] : i32) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -192,8 +181,7 @@ subroutine acc_kernels_loop
! CHECK: [[NUMWORKERS2:%.*]] = fir.load %{{.*}} : !fir.ref<i32>
! CHECK: acc.kernels num_workers([[NUMWORKERS2]] : i32) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -206,8 +194,7 @@ subroutine acc_kernels_loop
! CHECK: [[VECTORLENGTH1:%.*]] = arith.constant 128 : i32
! CHECK: acc.kernels vector_length([[VECTORLENGTH1]] : i32) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -220,8 +207,7 @@ subroutine acc_kernels_loop
! CHECK: [[VECTORLENGTH2:%.*]] = fir.load %{{.*}} : !fir.ref<i32>
! CHECK: acc.kernels vector_length([[VECTORLENGTH2]] : i32) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -234,8 +220,7 @@ subroutine acc_kernels_loop
! CHECK: [[IF1:%.*]] = arith.constant true
! CHECK: acc.kernels if([[IF1]]) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -249,8 +234,7 @@ subroutine acc_kernels_loop
! CHECK: [[IFCOND:%.*]] = fir.load %{{.*}} : !fir.ref<!fir.logical<4>>
! CHECK: [[IF2:%.*]] = fir.convert [[IFCOND]] : (!fir.logical<4>) -> i1
! CHECK: acc.kernels if([[IF2]]) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -263,8 +247,7 @@ subroutine acc_kernels_loop
! CHECK: [[SELF1:%.*]] = arith.constant true
! CHECK: acc.kernels self([[SELF1]]) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -276,8 +259,7 @@ subroutine acc_kernels_loop
END DO
! CHECK: acc.kernels {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -290,8 +272,7 @@ subroutine acc_kernels_loop
! CHECK: %[[SELF2:.*]] = fir.convert %[[IFCONDITION]] : (!fir.ref<!fir.logical<4>>) -> i1
! CHECK: acc.kernels self(%[[SELF2]]) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -305,8 +286,7 @@ subroutine acc_kernels_loop
! CHECK: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {dataClause = #acc<data_clause acc_copy>, name = "a"}
! CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {dataClause = #acc<data_clause acc_copy>, name = "b"}
! CHECK: acc.kernels dataOperands(%[[COPYIN_A]], %[[COPYIN_B]] : !fir.ref<!fir.array<10xf32>>, !fir.ref<!fir.array<10xf32>>) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -322,8 +302,7 @@ subroutine acc_kernels_loop
! CHECK: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {dataClause = #acc<data_clause acc_copy>, name = "a"}
! CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {dataClause = #acc<data_clause acc_copy>, name = "b"}
! CHECK: acc.kernels dataOperands(%[[COPYIN_A]], %[[COPYIN_B]] : !fir.ref<!fir.array<10xf32>>, !fir.ref<!fir.array<10xf32>>) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -339,8 +318,7 @@ subroutine acc_kernels_loop
! CHECK: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {name = "a"}
! CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {dataClause = #acc<data_clause acc_copyin_readonly>, name = "b"}
! CHECK: acc.kernels dataOperands(%[[COPYIN_A]], %[[COPYIN_B]] : !fir.ref<!fir.array<10xf32>>, !fir.ref<!fir.array<10xf32>>) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -354,8 +332,7 @@ subroutine acc_kernels_loop
! CHECK: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {dataClause = #acc<data_clause acc_copyout>, name = "a"}
! CHECK: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {dataClause = #acc<data_clause acc_copyout>, name = "b"}
! CHECK: acc.kernels dataOperands(%[[CREATE_A]], %[[CREATE_B]] : !fir.ref<!fir.array<10xf32>>, !fir.ref<!fir.array<10xf32>>) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -371,8 +348,7 @@ subroutine acc_kernels_loop
! CHECK: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {name = "b"}
! CHECK: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {dataClause = #acc<data_clause acc_create_zero>, name = "a"}
! CHECK: acc.kernels dataOperands(%[[CREATE_B]], %[[CREATE_A]] : !fir.ref<!fir.array<10xf32>>, !fir.ref<!fir.array<10xf32>>) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -388,8 +364,7 @@ subroutine acc_kernels_loop
! CHECK: %[[NOCREATE_A:.*]] = acc.nocreate varPtr(%[[A]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {name = "a"}
! CHECK: %[[NOCREATE_B:.*]] = acc.nocreate varPtr(%[[B]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {name = "b"}
! CHECK: acc.kernels dataOperands(%[[NOCREATE_A]], %[[NOCREATE_B]] : !fir.ref<!fir.array<10xf32>>, !fir.ref<!fir.array<10xf32>>) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -403,8 +378,7 @@ subroutine acc_kernels_loop
! CHECK: %[[PRESENT_A:.*]] = acc.present varPtr(%[[A]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {name = "a"}
! CHECK: %[[PRESENT_B:.*]] = acc.present varPtr(%[[B]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {name = "b"}
! CHECK: acc.kernels dataOperands(%[[PRESENT_A]], %[[PRESENT_B]] : !fir.ref<!fir.array<10xf32>>, !fir.ref<!fir.array<10xf32>>) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -418,8 +392,7 @@ subroutine acc_kernels_loop
! CHECK: %[[DEVICEPTR_A:.*]] = acc.deviceptr varPtr(%[[A]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {name = "a"}
! CHECK: %[[DEVICEPTR_B:.*]] = acc.deviceptr varPtr(%[[B]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {name = "b"}
! CHECK: acc.kernels dataOperands(%[[DEVICEPTR_A]], %[[DEVICEPTR_B]] : !fir.ref<!fir.array<10xf32>>, !fir.ref<!fir.array<10xf32>>) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -437,8 +410,7 @@ subroutine acc_kernels_loop
! CHECK: %[[BOX_ADDR_G:.*]] = fir.box_addr %[[BOX_G]] : (!fir.box<!fir.ptr<f32>>) -> !fir.ptr<f32>
! CHECK: %[[ATTACH_G:.*]] = acc.attach varPtr(%[[BOX_ADDR_G]] : !fir.ptr<f32>) -> !fir.ptr<f32> {name = "g"}
! CHECK: acc.kernels dataOperands(%[[ATTACH_F]], %[[ATTACH_G]] : !fir.ptr<f32>, !fir.ptr<f32>) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -450,10 +422,9 @@ subroutine acc_kernels_loop
END DO
! CHECK: acc.kernels {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
-! CHECK-NEXT: } attributes {seq}
+! CHECK-NEXT: } attributes {inclusiveUpperbound = array<i1: true>, seq}
! CHECK: acc.terminator
! CHECK-NEXT: }{{$}}
@@ -463,10 +434,9 @@ subroutine acc_kernels_loop
END DO
! CHECK: acc.kernels {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
-! CHECK-NEXT: } attributes {auto}
+! CHECK-NEXT: } attributes {auto, inclusiveUpperbound = array<i1: true>}
! CHECK: acc.terminator
! CHECK-NEXT: }{{$}}
@@ -476,10 +446,9 @@ subroutine acc_kernels_loop
END DO
! CHECK: acc.kernels {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
-! CHECK-NEXT: } attributes {independent}
+! CHECK-NEXT: } attributes {inclusiveUpperbound = array<i1: true>, independent}
! CHECK: acc.terminator
! CHECK-NEXT: }{{$}}
@@ -489,8 +458,7 @@ subroutine acc_kernels_loop
END DO
! CHECK: acc.kernels {
-! CHECK: acc.loop gang {
-! CHECK: fir.do_loop
+! CHECK: acc.loop gang() {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -503,8 +471,7 @@ subroutine acc_kernels_loop
! CHECK: acc.kernels {
! CHECK: [[GANGNUM1:%.*]] = arith.constant 8 : i32
-! CHECK-NEXT: acc.loop gang(num=[[GANGNUM1]] : i32) {
-! CHECK: fir.do_loop
+! CHECK-NEXT: acc.loop gang(num=[[GANGNUM1]] : i32) {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -517,8 +484,7 @@ subroutine acc_kernels_loop
! CHECK: acc.kernels {
! CHECK: [[GANGNUM2:%.*]] = fir.load %{{.*}} : !fir.ref<i32>
-! CHECK-NEXT: acc.loop gang(num=[[GANGNUM2]] : i32) {
-! CHECK: fir.do_loop
+! CHECK-NEXT: acc.loop gang(num=[[GANGNUM2]] : i32) {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -531,7 +497,6 @@ subroutine acc_kernels_loop
! CHECK: acc.kernels {
! CHECK: acc.loop gang(num=%{{.*}} : i32, static=%{{.*}} : i32) {
-! CHECK: fir.do_loop
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -542,8 +507,7 @@ subroutine acc_kernels_loop
a(i) = b(i)
END DO
! CHECK: acc.kernels {
-! CHECK: acc.loop vector {
-! CHECK: fir.do_loop
+! CHECK: acc.loop vector() {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -556,8 +520,7 @@ subroutine acc_kernels_loop
! CHECK: acc.kernels {
! CHECK: [[CONSTANT128:%.*]] = arith.constant 128 : i32
-! CHECK: acc.loop vector([[CONSTANT128]] : i32) {
-! CHECK: fir.do_loop
+! CHECK: acc.loop vector([[CONSTANT128]] : i32) {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -570,8 +533,7 @@ subroutine acc_kernels_loop
! CHECK: acc.kernels {
! CHECK: [[VECTORLENGTH:%.*]] = fir.load %{{.*}} : !fir.ref<i32>
-! CHECK: acc.loop vector([[VECTORLENGTH]] : i32) {
-! CHECK: fir.do_loop
+! CHECK: acc.loop vector([[VECTORLENGTH]] : i32) {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -583,8 +545,7 @@ subroutine acc_kernels_loop
END DO
! CHECK: acc.kernels {
-! CHECK: acc.loop worker {
-! CHECK: fir.do_loop
+! CHECK: acc.loop worker() {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -597,8 +558,7 @@ subroutine acc_kernels_loop
! CHECK: acc.kernels {
! CHECK: [[WORKER128:%.*]] = arith.constant 128 : i32
-! CHECK: acc.loop worker([[WORKER128]] : i32) {
-! CHECK: fir.do_loop
+! CHECK: acc.loop worker([[WORKER128]] : i32) {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -612,11 +572,9 @@ subroutine acc_kernels_loop
END DO
! CHECK: acc.kernels {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
-! CHECK-NEXT: } attributes {collapse = 2 : i64}
+! CHECK-NEXT: } attributes {collapse = 2 : i64, inclusiveUpperbound = array<i1: true, true>}
! CHECK: acc.terminator
! CHECK-NEXT: }{{$}}
@@ -629,10 +587,8 @@ subroutine acc_kernels_loop
END DO
! CHECK: acc.kernels {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -647,8 +603,7 @@ subroutine acc_kernels_loop
! CHECK: acc.kernels {
! CHECK: [[TILESIZE:%.*]] = arith.constant 2 : i32
-! CHECK: acc.loop tile([[TILESIZE]] : i32) {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} tile([[TILESIZE]] : i32) {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -661,8 +616,7 @@ subroutine acc_kernels_loop
! CHECK: acc.kernels {
! CHECK: [[TILESIZEM1:%.*]] = arith.constant -1 : i32
-! CHECK: acc.loop tile([[TILESIZEM1]] : i32) {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} tile([[TILESIZEM1]] : i32) {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -678,8 +632,7 @@ subroutine acc_kernels_loop
! CHECK: acc.kernels {
! CHECK: [[TILESIZE1:%.*]] = arith.constant 2 : i32
! CHECK: [[TILESIZE2:%.*]] = arith.constant 2 : i32
-! CHECK: acc.loop tile([[TILESIZE1]], [[TILESIZE2]] : i32, i32) {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} tile([[TILESIZE1]], [[TILESIZE2]] : i32, i32) {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -691,8 +644,7 @@ subroutine acc_kernels_loop
END DO
! CHECK: acc.kernels {
-! CHECK: acc.loop tile(%{{.*}} : i32) {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} tile(%{{.*}} : i32) {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -706,8 +658,7 @@ subroutine acc_kernels_loop
END DO
! CHECK: acc.kernels {
-! CHECK: acc.loop tile(%{{.*}}, %{{.*}} : i32, i32) {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} tile(%{{.*}}, %{{.*}} : i32, i32) {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
@@ -720,8 +671,7 @@ subroutine acc_kernels_loop
end do
! CHECK: acc.kernels {
-! CHECK: acc.loop reduction(@reduction_add_ref_f32 -> %{{.*}} : !fir.ref<f32>, @reduction_mul_ref_i32 -> %{{.*}} : !fir.ref<i32>) {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} reduction(@reduction_add_ref_f32 -> %{{.*}} : !fir.ref<f32>, @reduction_mul_ref_i32 -> %{{.*}} : !fir.ref<i32>) {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.terminator
diff --git a/flang/test/Lower/OpenACC/acc-loop.f90 b/flang/test/Lower/OpenACC/acc-loop.f90
index eac4fa41af82a3..78897354f90350 100644
--- a/flang/test/Lower/OpenACC/acc-loop.f90
+++ b/flang/test/Lower/OpenACC/acc-loop.f90
@@ -27,185 +27,168 @@ program acc_loop
a(i) = b(i)
END DO
-!CHECK: acc.loop {
-!CHECK: fir.do_loop
-!CHECK: acc.yield
-!CHECK-NEXT: }{{$}}
+! CHECK: acc.loop private(@privatization_ref_i32 -> %{{.*}} : !fir.ref<i32>) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) {
+! CHECK: acc.yield
+! CHECK-NEXT: } attributes {inclusiveUpperbound = array<i1: true>}{{$}}
!$acc loop seq
DO i = 1, n
a(i) = b(i)
END DO
-!CHECK: acc.loop {
-!CHECK: fir.do_loop
-!CHECK: acc.yield
-!CHECK-NEXT: } attributes {seq}
+! CHECK: acc.loop private(@privatization_ref_i32 -> %{{.*}} : !fir.ref<i32>) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) {
+! CHECK: acc.yield
+! CHECK-NEXT: } attributes {inclusiveUpperbound = array<i1: true>, seq}
!$acc loop auto
DO i = 1, n
a(i) = b(i)
END DO
-!CHECK: acc.loop {
-!CHECK: fir.do_loop
-!CHECK: acc.yield
-!CHECK-NEXT: } attributes {auto}
+! CHECK: acc.loop private(@privatization_ref_i32 -> %{{.*}} : !fir.ref<i32>) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) {
+! CHECK: acc.yield
+! CHECK-NEXT: } attributes {auto, inclusiveUpperbound = array<i1: true>}
!$acc loop independent
DO i = 1, n
a(i) = b(i)
END DO
-!CHECK: acc.loop {
-!CHECK: fir.do_loop
-!CHECK: acc.yield
-!CHECK-NEXT: } attributes {independent}
+! CHECK: acc.loop private(@privatization_ref_i32 -> %{{.*}} : !fir.ref<i32>) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) {
+! CHECK: acc.yield
+! CHECK-NEXT: } attributes {inclusiveUpperbound = array<i1: true>, independent}
!$acc loop gang
DO i = 1, n
a(i) = b(i)
END DO
-!CHECK: acc.loop gang {
-!CHECK: fir.do_loop
-!CHECK: acc.yield
-!CHECK-NEXT: }{{$}}
+! CHECK: acc.loop gang() private(@privatization_ref_i32 -> %{{.*}} : !fir.ref<i32>) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) {
+! CHECK: acc.yield
+! CHECK-NEXT: } attributes {inclusiveUpperbound = array<i1: true>}
!$acc loop gang(num: 8)
DO i = 1, n
a(i) = b(i)
END DO
-!CHECK: [[GANGNUM1:%.*]] = arith.constant 8 : i32
-!CHECK-NEXT: acc.loop gang(num=[[GANGNUM1]] : i32) {
-!CHECK: fir.do_loop
-!CHECK: acc.yield
-!CHECK-NEXT: }{{$}}
+! CHECK: [[GANGNUM1:%.*]] = arith.constant 8 : i32
+! CHECK-NEXT: acc.loop gang(num=[[GANGNUM1]] : i32) private(@privatization_ref_i32 -> %{{.*}} : !fir.ref<i32>) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) {
+! CHECK: acc.yield
+! CHECK-NEXT: } attributes {inclusiveUpperbound = array<i1: true>}
!$acc loop gang(num: gangNum)
DO i = 1, n
a(i) = b(i)
END DO
-!CHECK: [[GANGNUM2:%.*]] = fir.load %{{.*}} : !fir.ref<i32>
-!CHECK-NEXT: acc.loop gang(num=[[GANGNUM2]] : i32) {
-!CHECK: fir.do_loop
-!CHECK: acc.yield
-!CHECK-NEXT: }{{$}}
+! CHECK: [[GANGNUM2:%.*]] = fir.load %{{.*}} : !fir.ref<i32>
+! CHECK-NEXT: acc.loop gang(num=[[GANGNUM2]] : i32) private(@privatization_ref_i32 -> %{{.*}} : !fir.ref<i32>) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) {
+! CHECK: acc.yield
+! CHECK-NEXT: } attributes {inclusiveUpperbound = array<i1: true>}
!$acc loop gang(num: gangNum, static: gangStatic)
DO i = 1, n
a(i) = b(i)
END DO
-!CHECK: acc.loop gang(num=%{{.*}} : i32, static=%{{.*}} : i32) {
-!CHECK: fir.do_loop
-!CHECK: acc.yield
-!CHECK-NEXT: }{{$}}
+! CHECK: acc.loop gang(num=%{{.*}} : i32, static=%{{.*}} : i32) private(@privatization_ref_i32 -> %{{.*}} : !fir.ref<i32>) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) {
+! CHECK: acc.yield
+! CHECK-NEXT: } attributes {inclusiveUpperbound = array<i1: true>}
!$acc loop vector
DO i = 1, n
a(i) = b(i)
END DO
-!CHECK: acc.loop vector {
-!CHECK: fir.do_loop
-!CHECK: acc.yield
-!CHECK-NEXT: }{{$}}
+! CHECK: acc.loop vector() private(@privatization_ref_i32 -> %{{.*}} : !fir.ref<i32>) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) {
+! CHECK: acc.yield
+! CHECK-NEXT: } attributes {inclusiveUpperbound = array<i1: true>}
!$acc loop vector(128)
DO i = 1, n
a(i) = b(i)
END DO
-!CHECK: [[CONSTANT128:%.*]] = arith.constant 128 : i32
-!CHECK: acc.loop vector([[CONSTANT128]] : i32) {
-!CHECK: fir.do_loop
-!CHECK: acc.yield
-!CHECK-NEXT: }{{$}}
+! CHECK: [[CONSTANT128:%.*]] = arith.constant 128 : i32
+! CHECK: acc.loop vector([[CONSTANT128]] : i32) private(@privatization_ref_i32 -> %{{.*}} : !fir.ref<i32>) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) {
+! CHECK: acc.yield
+! CHECK-NEXT: }{{$}}
!$acc loop vector(vectorLength)
DO i = 1, n
a(i) = b(i)
END DO
-!CHECK: [[VECTORLENGTH:%.*]] = fir.load %{{.*}} : !fir.ref<i32>
-!CHECK: acc.loop vector([[VECTORLENGTH]] : i32) {
-!CHECK: fir.do_loop
-!CHECK: acc.yield
-!CHECK-NEXT: }{{$}}
+! CHECK: [[VECTORLENGTH:%.*]] = fir.load %{{.*}} : !fir.ref<i32>
+! CHECK: acc.loop vector([[VECTORLENGTH]] : i32) private(@privatization_ref_i32 -> %{{.*}} : !fir.ref<i32>) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) {
+! CHECK: acc.yield
+! CHECK-NEXT: } attributes {inclusiveUpperbound = array<i1: true>}
!$acc loop worker
DO i = 1, n
a(i) = b(i)
END DO
-!CHECK: acc.loop worker {
-!CHECK: fir.do_loop
-!CHECK: acc.yield
-!CHECK-NEXT: }{{$}}
+! CHECK: acc.loop worker() private(@privatization_ref_i32 -> %{{.*}} : !fir.ref<i32>) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) {
+! CHECK: acc.yield
+! CHECK-NEXT: } attributes {inclusiveUpperbound = array<i1: true>}
!$acc loop worker(128)
DO i = 1, n
a(i) = b(i)
END DO
-!CHECK: [[WORKER128:%.*]] = arith.constant 128 : i32
-!CHECK: acc.loop worker([[WORKER128]] : i32) {
-!CHECK: fir.do_loop
-!CHECK: acc.yield
-!CHECK-NEXT: }{{$}}
+! CHECK: [[WORKER128:%.*]] = arith.constant 128 : i32
+! CHECK: acc.loop worker([[WORKER128]] : i32) private(@privatization_ref_i32 -> %{{.*}} : !fir.ref<i32>) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) {
+! CHECK: acc.yield
+! CHECK-NEXT: } attributes {inclusiveUpperbound = array<i1: true>}
!$acc loop private(c)
DO i = 1, n
a(i) = b(i)
END DO
-!CHECK: acc.loop private(@privatization_ref_10x10xf32 -> %{{.*}} : !fir.ref<!fir.array<10x10xf32>>) {
-!CHECK: fir.do_loop
-!CHECK: acc.yield
-!CHECK-NEXT: }{{$}}
+! CHECK: acc.loop private(@privatization_ref_i32 -> %{{.*}} : !fir.ref<i32>, @privatization_ref_10x10xf32 -> %{{.*}} : !fir.ref<!fir.array<10x10xf32>>) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) {
+! CHECK: acc.yield
+! CHECK-NEXT: } attributes {inclusiveUpperbound = array<i1: true>}
!$acc loop private(c, d)
DO i = 1, n
a(i) = b(i)
END DO
-!CHECK: acc.loop private(@privatization_ref_10x10xf32 -> %{{.*}} : !fir.ref<!fir.array<10x10xf32>>, @privatization_ref_10x10xf32 -> %{{.*}} : !fir.ref<!fir.array<10x10xf32>>) {
-!CHECK: fir.do_loop
-!CHECK: acc.yield
-!CHECK-NEXT: }{{$}}
+! CHECK: acc.loop private(@privatization_ref_i32 -> %{{.*}} : !fir.ref<i32>, @privatization_ref_10x10xf32 -> %{{.*}} : !fir.ref<!fir.array<10x10xf32>>, @privatization_ref_10x10xf32 -> %{{.*}} : !fir.ref<!fir.array<10x10xf32>>) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) {
+! CHECK: acc.yield
+! CHECK-NEXT: } attributes {inclusiveUpperbound = array<i1: true>}
!$acc loop private(c) private(d)
DO i = 1, n
a(i) = b(i)
END DO
-!CHECK: acc.loop private(@privatization_ref_10x10xf32 -> %{{.*}} : !fir.ref<!fir.array<10x10xf32>>, @privatization_ref_10x10xf32 -> %{{.*}} : !fir.ref<!fir.array<10x10xf32>>) {
-!CHECK: fir.do_loop
-!CHECK: acc.yield
-!CHECK-NEXT: }{{$}}
+! CHECK: acc.loop private(@privatization_ref_i32 -> %{{.*}} : !fir.ref<i32>, @privatization_ref_10x10xf32 -> %{{.*}} : !fir.ref<!fir.array<10x10xf32>>, @privatization_ref_10x10xf32 -> %{{.*}} : !fir.ref<!fir.array<10x10xf32>>) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) {
+! CHECK: acc.yield
+! CHECK-NEXT: } attributes {inclusiveUpperbound = array<i1: true>}
!$acc loop tile(2)
DO i = 1, n
a(i) = b(i)
END DO
-!CHECK: [[TILESIZE:%.*]] = arith.constant 2 : i32
-!CHECK: acc.loop tile([[TILESIZE]] : i32) {
-!CHECK: fir.do_loop
-!CHECK: acc.yield
-!CHECK-NEXT: }{{$}}
+
+! CHECK: [[TILESIZE:%.*]] = arith.constant 2 : i32
+! CHECK: acc.loop {{.*}} tile([[TILESIZE]] : i32) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) {
+! CHECK: acc.yield
+! CHECK-NEXT: } attributes {inclusiveUpperbound = array<i1: true>}
!$acc loop tile(*)
DO i = 1, n
a(i) = b(i)
END DO
-!CHECK: [[TILESIZEM1:%.*]] = arith.constant -1 : i32
-!CHECK: acc.loop tile([[TILESIZEM1]] : i32) {
-!CHECK: fir.do_loop
-!CHECK: acc.yield
-!CHECK-NEXT: }{{$}}
+! CHECK: [[TILESIZEM1:%.*]] = arith.constant -1 : i32
+! CHECK: acc.loop {{.*}} tile([[TILESIZEM1]] : i32) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) {
+! CHECK: acc.yield
+! CHECK-NEXT: } attributes {inclusiveUpperbound = array<i1: true>}
!$acc loop tile(2, 2)
DO i = 1, n
@@ -214,22 +197,20 @@ program acc_loop
END DO
END DO
-!CHECK: [[TILESIZE1:%.*]] = arith.constant 2 : i32
-!CHECK: [[TILESIZE2:%.*]] = arith.constant 2 : i32
-!CHECK: acc.loop tile([[TILESIZE1]], [[TILESIZE2]] : i32, i32) {
-!CHECK: fir.do_loop
-!CHECK: acc.yield
-!CHECK-NEXT: }{{$}}
+! CHECK: [[TILESIZE1:%.*]] = arith.constant 2 : i32
+! CHECK: [[TILESIZE2:%.*]] = arith.constant 2 : i32
+! CHECK: acc.loop {{.*}} tile([[TILESIZE1]], [[TILESIZE2]] : i32, i32) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) {
+! CHECK: acc.yield
+! CHECK-NEXT: } attributes {inclusiveUpperbound = array<i1: true>}
!$acc loop tile(tileSize)
DO i = 1, n
a(i) = b(i)
END DO
-!CHECK: acc.loop tile(%{{.*}} : i32) {
-!CHECK: fir.do_loop
-!CHECK: acc.yield
-!CHECK-NEXT: }{{$}}
+! CHECK: acc.loop {{.*}} tile(%{{.*}} : i32) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) {
+! CHECK: acc.yield
+! CHECK-NEXT: } attributes {inclusiveUpperbound = array<i1: true>}
!$acc loop tile(tileSize, tileSize)
DO i = 1, n
@@ -238,10 +219,9 @@ program acc_loop
END DO
END DO
-!CHECK: acc.loop tile(%{{.*}}, %{{.*}} : i32, i32) {
-!CHECK: fir.do_loop
-!CHECK: acc.yield
-!CHECK-NEXT: }{{$}}
+! CHECK: acc.loop {{.*}} tile(%{{.*}}, %{{.*}} : i32, i32) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) {
+! CHECK: acc.yield
+! CHECK-NEXT: } attributes {inclusiveUpperbound = array<i1: true>}
!$acc loop collapse(2)
DO i = 1, n
@@ -250,11 +230,9 @@ program acc_loop
END DO
END DO
-!CHECK: acc.loop {
-!CHECK: fir.do_loop
-!CHECK: fir.do_loop
-!CHECK: acc.yield
-!CHECK-NEXT: } attributes {collapse = 2 : i64}
+! CHECK: acc.loop {{.*}} (%arg0 : i32, %arg1 : i32) = (%{{.*}} : i32, i32) to (%{{.*}} : i32, i32) step (%{{.*}} : i32, i32) {
+! CHECK: acc.yield
+! CHECK-NEXT: } attributes {collapse = 2 : i64, inclusiveUpperbound = array<i1: true, true>}
!$acc loop
DO i = 1, n
@@ -264,14 +242,12 @@ program acc_loop
END DO
END DO
-!CHECK: acc.loop {
-!CHECK: fir.do_loop
-!CHECK: acc.loop {
-!CHECK: fir.do_loop
-!CHECK: acc.yield
-!CHECK-NEXT: }{{$}}
-!CHECK: acc.yield
-!CHECK-NEXT: }{{$}}
+! CHECK: acc.loop {{.*}} (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) {
+! CHECK: acc.loop {{.*}} (%arg1 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) {
+! CHECK: acc.yield
+! CHECK-NEXT: } attributes {inclusiveUpperbound = array<i1: true>}
+! CHECK: acc.yield
+! CHECK-NEXT: } attributes {inclusiveUpperbound = array<i1: true>}
!$acc loop reduction(+:reduction_r) reduction(*:reduction_i)
do i = 1, n
@@ -279,30 +255,26 @@ program acc_loop
reduction_i = 1
end do
-! CHECK: acc.loop reduction(@reduction_add_ref_f32 -> %{{.*}} : !fir.ref<f32>, @reduction_mul_ref_i32 -> %{{.*}} : !fir.ref<i32>) {
-! CHECK: fir.do_loop
+! CHECK: acc.loop private(@privatization_ref_i32 -> %{{.*}} : !fir.ref<i32>) reduction(@reduction_add_ref_f32 -> %{{.*}} : !fir.ref<f32>, @reduction_mul_ref_i32 -> %{{.*}} : !fir.ref<i32>) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) {
! CHECK: acc.yield
-! CHECK-NEXT: }{{$}}
+! CHECK-NEXT: } attributes {inclusiveUpperbound = array<i1: true>}
!$acc loop gang(dim: gangDim, static: gangStatic)
DO i = 1, n
a(i) = b(i)
END DO
-!CHECK: acc.loop gang(dim=%{{.*}}, static=%{{.*}} : i32) {
-!CHECK: fir.do_loop
-!CHECK: acc.yield
-!CHECK-NEXT: }{{$}}
+! CHECK: acc.loop gang(dim=%{{.*}}, static=%{{.*}} : i32) {{.*}} (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) {
+! CHECK: acc.yield
+! CHECK-NEXT: } attributes {inclusiveUpperbound = array<i1: true>}
!$acc loop gang(dim: 1)
DO i = 1, n
a(i) = b(i)
END DO
-!CHECK: [[GANGDIM1:%.*]] = arith.constant 1 : i32
-!CHECK-NEXT: acc.loop gang(dim=[[GANGDIM1]] : i32) {
-!CHECK: fir.do_loop
-!CHECK: acc.yield
-!CHECK-NEXT: }{{$}}
+! CHECK: acc.loop gang(dim=%{{.*}} : i32) {{.*}} (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) {
+! CHECK: acc.yield
+! CHECK-NEXT: } attributes {inclusiveUpperbound = array<i1: true>}
end program
diff --git a/flang/test/Lower/OpenACC/acc-parallel-loop.f90 b/flang/test/Lower/OpenACC/acc-parallel-loop.f90
index 2e65ddbd36db43..3b95f8ab1a8262 100644
--- a/flang/test/Lower/OpenACC/acc-parallel-loop.f90
+++ b/flang/test/Lower/OpenACC/acc-parallel-loop.f90
@@ -62,8 +62,7 @@ subroutine acc_parallel_loop
END DO
! CHECK: acc.parallel {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -76,8 +75,7 @@ subroutine acc_parallel_loop
!$acc end parallel loop
! CHECK: acc.parallel {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -90,8 +88,7 @@ subroutine acc_parallel_loop
! CHECK: [[ASYNC1:%.*]] = arith.constant 1 : i32
! CHECK: acc.parallel async([[ASYNC1]] : i32) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -104,8 +101,7 @@ subroutine acc_parallel_loop
! CHECK: [[ASYNC2:%.*]] = fir.load %{{.*}} : !fir.ref<i32>
! CHECK: acc.parallel async([[ASYNC2]] : i32) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -117,8 +113,7 @@ subroutine acc_parallel_loop
END DO
! CHECK: acc.parallel {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -131,8 +126,7 @@ subroutine acc_parallel_loop
! CHECK: [[WAIT1:%.*]] = arith.constant 1 : i32
! CHECK: acc.parallel wait([[WAIT1]] : i32) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -146,8 +140,7 @@ subroutine acc_parallel_loop
! CHECK: [[WAIT2:%.*]] = arith.constant 1 : i32
! CHECK: [[WAIT3:%.*]] = arith.constant 2 : i32
! CHECK: acc.parallel wait([[WAIT2]], [[WAIT3]] : i32, i32) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -161,8 +154,7 @@ subroutine acc_parallel_loop
! CHECK: [[WAIT4:%.*]] = fir.load %{{.*}} : !fir.ref<i32>
! CHECK: [[WAIT5:%.*]] = fir.load %{{.*}} : !fir.ref<i32>
! CHECK: acc.parallel wait([[WAIT4]], [[WAIT5]] : i32, i32) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -175,8 +167,7 @@ subroutine acc_parallel_loop
! CHECK: [[NUMGANGS1:%.*]] = arith.constant 1 : i32
! CHECK: acc.parallel num_gangs([[NUMGANGS1]] : i32) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -189,8 +180,7 @@ subroutine acc_parallel_loop
! CHECK: [[NUMGANGS2:%.*]] = fir.load %{{.*}} : !fir.ref<i32>
! CHECK: acc.parallel num_gangs([[NUMGANGS2]] : i32) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -203,8 +193,7 @@ subroutine acc_parallel_loop
! CHECK: [[NUMWORKERS1:%.*]] = arith.constant 10 : i32
! CHECK: acc.parallel num_workers([[NUMWORKERS1]] : i32) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -217,8 +206,7 @@ subroutine acc_parallel_loop
! CHECK: [[NUMWORKERS2:%.*]] = fir.load %{{.*}} : !fir.ref<i32>
! CHECK: acc.parallel num_workers([[NUMWORKERS2]] : i32) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -231,8 +219,7 @@ subroutine acc_parallel_loop
! CHECK: [[VECTORLENGTH1:%.*]] = arith.constant 128 : i32
! CHECK: acc.parallel vector_length([[VECTORLENGTH1]] : i32) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -245,8 +232,7 @@ subroutine acc_parallel_loop
! CHECK: [[VECTORLENGTH2:%.*]] = fir.load %{{.*}} : !fir.ref<i32>
! CHECK: acc.parallel vector_length([[VECTORLENGTH2]] : i32) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -259,8 +245,7 @@ subroutine acc_parallel_loop
! CHECK: [[IF1:%.*]] = arith.constant true
! CHECK: acc.parallel if([[IF1]]) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -274,8 +259,7 @@ subroutine acc_parallel_loop
! CHECK: [[IFCOND:%.*]] = fir.load %{{.*}} : !fir.ref<!fir.logical<4>>
! CHECK: [[IF2:%.*]] = fir.convert [[IFCOND]] : (!fir.logical<4>) -> i1
! CHECK: acc.parallel if([[IF2]]) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -288,8 +272,7 @@ subroutine acc_parallel_loop
! CHECK: [[SELF1:%.*]] = arith.constant true
! CHECK: acc.parallel self([[SELF1]]) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -301,8 +284,7 @@ subroutine acc_parallel_loop
END DO
! CHECK: acc.parallel {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -315,8 +297,7 @@ subroutine acc_parallel_loop
! CHECK: %[[SELF2:.*]] = fir.convert %[[IFCONDITION]] : (!fir.ref<!fir.logical<4>>) -> i1
! CHECK: acc.parallel self(%[[SELF2]]) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -330,8 +311,7 @@ subroutine acc_parallel_loop
! CHECK: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {dataClause = #acc<data_clause acc_copy>, name = "a"}
! CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {dataClause = #acc<data_clause acc_copy>, name = "b"}
! CHECK: acc.parallel dataOperands(%[[COPYIN_A]], %[[COPYIN_B]] : !fir.ref<!fir.array<10xf32>>, !fir.ref<!fir.array<10xf32>>) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -347,8 +327,7 @@ subroutine acc_parallel_loop
! CHECK: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {dataClause = #acc<data_clause acc_copy>, name = "a"}
! CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {dataClause = #acc<data_clause acc_copy>, name = "b"}
! CHECK: acc.parallel dataOperands(%[[COPYIN_A]], %[[COPYIN_B]] : !fir.ref<!fir.array<10xf32>>, !fir.ref<!fir.array<10xf32>>) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -364,8 +343,7 @@ subroutine acc_parallel_loop
! CHECK: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {name = "a"}
! CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {dataClause = #acc<data_clause acc_copyin_readonly>, name = "b"}
! CHECK: acc.parallel dataOperands(%[[COPYIN_A]], %[[COPYIN_B]] : !fir.ref<!fir.array<10xf32>>, !fir.ref<!fir.array<10xf32>>) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -379,8 +357,7 @@ subroutine acc_parallel_loop
! CHECK: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {dataClause = #acc<data_clause acc_copyout>, name = "a"}
! CHECK: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {dataClause = #acc<data_clause acc_copyout>, name = "b"}
! CHECK: acc.parallel dataOperands(%[[CREATE_A]], %[[CREATE_B]] : !fir.ref<!fir.array<10xf32>>, !fir.ref<!fir.array<10xf32>>) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -396,8 +373,7 @@ subroutine acc_parallel_loop
! CHECK: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {name = "b"}
! CHECK: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {dataClause = #acc<data_clause acc_create_zero>, name = "a"}
! CHECK: acc.parallel dataOperands(%[[CREATE_B]], %[[CREATE_A]] : !fir.ref<!fir.array<10xf32>>, !fir.ref<!fir.array<10xf32>>) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -413,8 +389,7 @@ subroutine acc_parallel_loop
! CHECK: %[[NOCREATE_A:.*]] = acc.nocreate varPtr(%[[A]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {name = "a"}
! CHECK: %[[NOCREATE_B:.*]] = acc.nocreate varPtr(%[[B]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {name = "b"}
! CHECK: acc.parallel dataOperands(%[[NOCREATE_A]], %[[NOCREATE_B]] : !fir.ref<!fir.array<10xf32>>, !fir.ref<!fir.array<10xf32>>) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -428,8 +403,7 @@ subroutine acc_parallel_loop
! CHECK: %[[PRESENT_A:.*]] = acc.present varPtr(%[[A]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {name = "a"}
! CHECK: %[[PRESENT_B:.*]] = acc.present varPtr(%[[B]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {name = "b"}
! CHECK: acc.parallel dataOperands(%[[PRESENT_A]], %[[PRESENT_B]] : !fir.ref<!fir.array<10xf32>>, !fir.ref<!fir.array<10xf32>>) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -443,8 +417,7 @@ subroutine acc_parallel_loop
! CHECK: %[[DEVICEPTR_A:.*]] = acc.deviceptr varPtr(%[[A]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {name = "a"}
! CHECK: %[[DEVICEPTR_B:.*]] = acc.deviceptr varPtr(%[[B]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {name = "b"}
! CHECK: acc.parallel dataOperands(%[[DEVICEPTR_A]], %[[DEVICEPTR_B]] : !fir.ref<!fir.array<10xf32>>, !fir.ref<!fir.array<10xf32>>) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -462,8 +435,7 @@ subroutine acc_parallel_loop
! CHECK: %[[BOX_ADDR_G:.*]] = fir.box_addr %[[BOX_G]] : (!fir.box<!fir.ptr<f32>>) -> !fir.ptr<f32>
! CHECK: %[[ATTACH_G:.*]] = acc.attach varPtr(%[[BOX_ADDR_G]] : !fir.ptr<f32>) -> !fir.ptr<f32> {name = "g"}
! CHECK: acc.parallel dataOperands(%[[ATTACH_F]], %[[ATTACH_G]] : !fir.ptr<f32>, !fir.ptr<f32>) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -478,8 +450,7 @@ subroutine acc_parallel_loop
! CHECK: %[[ACC_PRIVATE_B:.*]] = acc.firstprivate varPtr(%[[B]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {name = "b"}
! CHECK: acc.parallel firstprivate(@firstprivatization_ref_10xf32 -> %[[ACC_PRIVATE_B]] : !fir.ref<!fir.array<10xf32>>) private(@privatization_ref_10xf32 -> %[[ACC_PRIVATE_A]] : !fir.ref<!fir.array<10xf32>>) {
! CHECK: %[[ACC_PRIVATE_A:.*]] = acc.private varPtr(%[[A]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {name = "a"}
-! CHECK: acc.loop private(@privatization_ref_10xf32 -> %[[ACC_PRIVATE_A]] : !fir.ref<!fir.array<10xf32>>) {
-! CHECK: fir.do_loop
+! CHECK: acc.loop private(@privatization_ref_i32 -> %{{.*}} : !fir.ref<i32>, @privatization_ref_10xf32 -> %[[ACC_PRIVATE_A]] : !fir.ref<!fir.array<10xf32>>)
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -491,10 +462,9 @@ subroutine acc_parallel_loop
END DO
! CHECK: acc.parallel {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
-! CHECK-NEXT: } attributes {seq}
+! CHECK-NEXT: } attributes {inclusiveUpperbound = array<i1: true>, seq}
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
@@ -504,10 +474,9 @@ subroutine acc_parallel_loop
END DO
! CHECK: acc.parallel {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
-! CHECK-NEXT: } attributes {auto}
+! CHECK-NEXT: } attributes {auto, inclusiveUpperbound = array<i1: true>}
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
@@ -517,10 +486,9 @@ subroutine acc_parallel_loop
END DO
! CHECK: acc.parallel {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
-! CHECK-NEXT: } attributes {independent}
+! CHECK-NEXT: } attributes {inclusiveUpperbound = array<i1: true>, independent}
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
@@ -530,8 +498,7 @@ subroutine acc_parallel_loop
END DO
! CHECK: acc.parallel {
-! CHECK: acc.loop gang {
-! CHECK: fir.do_loop
+! CHECK: acc.loop gang() {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -544,8 +511,7 @@ subroutine acc_parallel_loop
! CHECK: acc.parallel {
! CHECK: [[GANGNUM1:%.*]] = arith.constant 8 : i32
-! CHECK-NEXT: acc.loop gang(num=[[GANGNUM1]] : i32) {
-! CHECK: fir.do_loop
+! CHECK-NEXT: acc.loop gang(num=[[GANGNUM1]] : i32) {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -558,8 +524,7 @@ subroutine acc_parallel_loop
! CHECK: acc.parallel {
! CHECK: [[GANGNUM2:%.*]] = fir.load %{{.*}} : !fir.ref<i32>
-! CHECK-NEXT: acc.loop gang(num=[[GANGNUM2]] : i32) {
-! CHECK: fir.do_loop
+! CHECK-NEXT: acc.loop gang(num=[[GANGNUM2]] : i32) {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -571,8 +536,7 @@ subroutine acc_parallel_loop
END DO
! CHECK: acc.parallel {
-! CHECK: acc.loop gang(num=%{{.*}} : i32, static=%{{.*}} : i32) {
-! CHECK: fir.do_loop
+! CHECK: acc.loop gang(num=%{{.*}} : i32, static=%{{.*}} : i32) {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -583,8 +547,7 @@ subroutine acc_parallel_loop
a(i) = b(i)
END DO
! CHECK: acc.parallel {
-! CHECK: acc.loop vector {
-! CHECK: fir.do_loop
+! CHECK: acc.loop vector() {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -597,8 +560,7 @@ subroutine acc_parallel_loop
! CHECK: acc.parallel {
! CHECK: [[CONSTANT128:%.*]] = arith.constant 128 : i32
-! CHECK: acc.loop vector([[CONSTANT128]] : i32) {
-! CHECK: fir.do_loop
+! CHECK: acc.loop vector([[CONSTANT128]] : i32) {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -611,7 +573,7 @@ subroutine acc_parallel_loop
! CHECK: acc.parallel {
! CHECK: [[VECTORLENGTH:%.*]] = fir.load %{{.*}} : !fir.ref<i32>
-! CHECK: acc.loop vector([[VECTORLENGTH]] : i32) {
+! CHECK: acc.loop vector([[VECTORLENGTH]] : i32) {{.*}} {
! CHECK: fir.do_loop
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
@@ -624,7 +586,7 @@ subroutine acc_parallel_loop
END DO
! CHECK: acc.parallel {
-! CHECK: acc.loop worker {
+! CHECK: acc.loop worker() {{.*}} {
! CHECK: fir.do_loop
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
@@ -638,7 +600,7 @@ subroutine acc_parallel_loop
! CHECK: acc.parallel {
! CHECK: [[WORKER128:%.*]] = arith.constant 128 : i32
-! CHECK: acc.loop worker([[WORKER128]] : i32) {
+! CHECK: acc.loop worker([[WORKER128]] : i32) {{.*}} {
! CHECK: fir.do_loop
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
@@ -653,11 +615,9 @@ subroutine acc_parallel_loop
END DO
! CHECK: acc.parallel {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
-! CHECK-NEXT: } attributes {collapse = 2 : i64}
+! CHECK-NEXT: } attributes {collapse = 2 : i64, inclusiveUpperbound = array<i1: true, true>}
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
@@ -670,10 +630,8 @@ subroutine acc_parallel_loop
END DO
! CHECK: acc.parallel {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -688,22 +646,7 @@ subroutine acc_parallel_loop
! CHECK: acc.parallel {
! CHECK: [[TILESIZE:%.*]] = arith.constant 2 : i32
-! CHECK: acc.loop tile([[TILESIZE]] : i32) {
-! CHECK: fir.do_loop
-! CHECK: acc.yield
-! CHECK-NEXT: }{{$}}
-! CHECK: acc.yield
-! CHECK-NEXT: }{{$}}
-
- !$acc parallel loop tile(*)
- DO i = 1, n
- a(i) = b(i)
- END DO
-
-! CHECK: acc.parallel {
-! CHECK: [[TILESIZEM1:%.*]] = arith.constant -1 : i32
-! CHECK: acc.loop tile([[TILESIZEM1]] : i32) {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} tile([[TILESIZE]] : i32) {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -719,8 +662,7 @@ subroutine acc_parallel_loop
! CHECK: acc.parallel {
! CHECK: [[TILESIZE1:%.*]] = arith.constant 2 : i32
! CHECK: [[TILESIZE2:%.*]] = arith.constant 2 : i32
-! CHECK: acc.loop tile([[TILESIZE1]], [[TILESIZE2]] : i32, i32) {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} tile([[TILESIZE1]], [[TILESIZE2]] : i32, i32) {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -732,8 +674,7 @@ subroutine acc_parallel_loop
END DO
! CHECK: acc.parallel {
-! CHECK: acc.loop tile(%{{.*}} : i32) {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} tile(%{{.*}} : i32) {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -747,8 +688,20 @@ subroutine acc_parallel_loop
END DO
! CHECK: acc.parallel {
-! CHECK: acc.loop tile(%{{.*}}, %{{.*}} : i32, i32) {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} tile(%{{.*}}, %{{.*}} : i32, i32) {{.*}} {
+! CHECK: acc.yield
+! CHECK-NEXT: }{{$}}
+! CHECK: acc.yield
+! CHECK-NEXT: }{{$}}
+
+ !$acc parallel loop tile(*)
+ DO i = 1, n
+ a(i) = b(i)
+ END DO
+
+! CHECK: acc.parallel {
+! CHECK: [[TILESIZEM1:%.*]] = arith.constant -1 : i32
+! CHECK: acc.loop {{.*}} tile([[TILESIZEM1]] : i32) {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -761,8 +714,7 @@ subroutine acc_parallel_loop
end do
! CHECK: acc.parallel reduction(@reduction_add_ref_f32 -> %{{.*}} : !fir.ref<f32>, @reduction_mul_ref_i32 -> %{{.*}} : !fir.ref<i32>) {
-! CHECK: acc.loop reduction(@reduction_add_ref_f32 -> %{{.*}} : !fir.ref<f32>, @reduction_mul_ref_i32 -> %{{.*}} : !fir.ref<i32>) {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} reduction(@reduction_add_ref_f32 -> %{{.*}} : !fir.ref<f32>, @reduction_mul_ref_i32 -> %{{.*}} : !fir.ref<i32>) {{.*}}
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
diff --git a/flang/test/Lower/OpenACC/acc-private.f90 b/flang/test/Lower/OpenACC/acc-private.f90
index c8709c826e0247..0afcf9c5521dd7 100644
--- a/flang/test/Lower/OpenACC/acc-private.f90
+++ b/flang/test/Lower/OpenACC/acc-private.f90
@@ -82,7 +82,7 @@ program acc_private
END DO
! CHECK: %[[C_PRIVATE:.*]] = acc.private varPtr(%[[C]] : !fir.ref<i32>) -> !fir.ref<i32> {name = "c"}
-! CHECK: acc.loop private(@privatization_ref_i32 -> %[[C_PRIVATE]] : !fir.ref<i32>)
+! CHECK: acc.loop private(@privatization_ref_i32 -> %{{.*}} : !fir.ref<i32>, @privatization_ref_i32 -> %[[C_PRIVATE]] : !fir.ref<i32>)
! CHECK: acc.yield
!$acc loop private(b)
@@ -96,7 +96,7 @@ program acc_private
! CHECK: %[[UB:.*]] = arith.subi %{{.*}}, %[[C1]] : index
! CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) extent(%{{.*}} : index) stride(%[[C1]] : index) startIdx(%[[C1]] : index)
! CHECK: %[[B_PRIVATE:.*]] = acc.private varPtr(%[[B]] : !fir.ref<!fir.array<100xf32>>) bounds(%[[BOUND]]) -> !fir.ref<!fir.array<100xf32>> {name = "b"}
-! CHECK: acc.loop private(@privatization_ref_100xf32 -> %[[B_PRIVATE]] : !fir.ref<!fir.array<100xf32>>) {
+! CHECK: acc.loop private(@privatization_ref_i32 -> %{{.*}} : !fir.ref<i32>, @privatization_ref_100xf32 -> %[[B_PRIVATE]] : !fir.ref<!fir.array<100xf32>>)
! CHECK: acc.yield
!$acc loop private(b(1:50))
@@ -110,7 +110,7 @@ program acc_private
! CHECK: %[[UB:.*]] = arith.constant 49 : index
! CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) stride(%[[C1]] : index) startIdx(%[[C1]] : index)
! CHECK: %[[B_PRIVATE:.*]] = acc.private varPtr(%[[B]] : !fir.ref<!fir.array<100xf32>>) bounds(%[[BOUND]]) -> !fir.ref<!fir.array<50xf32>> {name = "b(1:50)"}
-! CHECK: acc.loop private(@privatization_ref_50xf32 -> %[[B_PRIVATE]] : !fir.ref<!fir.array<50xf32>>)
+! CHECK: acc.loop private(@privatization_ref_i32 -> %{{.*}} : !fir.ref<i32>, @privatization_ref_50xf32 -> %[[B_PRIVATE]] : !fir.ref<!fir.array<50xf32>>)
!$acc parallel loop firstprivate(c)
DO i = 1, n
diff --git a/flang/test/Lower/OpenACC/acc-reduction.f90 b/flang/test/Lower/OpenACC/acc-reduction.f90
index 068b52636c0197..bddd596b0ac167 100644
--- a/flang/test/Lower/OpenACC/acc-reduction.f90
+++ b/flang/test/Lower/OpenACC/acc-reduction.f90
@@ -523,7 +523,7 @@ subroutine acc_reduction_add_int(a, b)
! CHECK-LABEL: func.func @_QPacc_reduction_add_int(
! CHECK-SAME: %{{.*}}: !fir.ref<!fir.array<100xi32>> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref<i32> {fir.bindc_name = "b"})
! CHECK: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref<i32>) -> !fir.ref<i32> {name = "b"}
-! CHECK: acc.loop reduction(@reduction_add_ref_i32 -> %[[RED_B]] : !fir.ref<i32>)
+! CHECK: acc.loop {{.*}} reduction(@reduction_add_ref_i32 -> %[[RED_B]] : !fir.ref<i32>)
subroutine acc_reduction_add_int_array_1d(a, b)
integer :: a(100)
@@ -538,7 +538,7 @@ subroutine acc_reduction_add_int_array_1d(a, b)
! CHECK-LABEL: func.func @_QPacc_reduction_add_int_array_1d(
! CHECK-SAME: %{{.*}}: !fir.ref<!fir.array<100xi32>> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref<!fir.array<100xi32>> {fir.bindc_name = "b"})
! CHECK: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref<!fir.array<100xi32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<100xi32>> {name = "b"}
-! CHECK: acc.loop reduction(@reduction_add_ref_100xi32 -> %[[RED_B]] : !fir.ref<!fir.array<100xi32>>)
+! CHECK: acc.loop {{.*}} reduction(@reduction_add_ref_100xi32 -> %[[RED_B]] : !fir.ref<!fir.array<100xi32>>)
subroutine acc_reduction_add_int_array_2d(a, b)
integer :: a(100, 10), b(100, 10)
@@ -555,8 +555,8 @@ subroutine acc_reduction_add_int_array_2d(a, b)
! CHECK-LABEL: func.func @_QPacc_reduction_add_int_array_2d(
! CHECK-SAME: %[[ARG0:.*]]: !fir.ref<!fir.array<100x10xi32>> {fir.bindc_name = "a"}, %[[ARG1:.*]]: !fir.ref<!fir.array<100x10xi32>> {fir.bindc_name = "b"}) {
! CHECK: %[[RED_ARG1:.*]] = acc.reduction varPtr(%[[ARG1]] : !fir.ref<!fir.array<100x10xi32>>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref<!fir.array<100x10xi32>> {name = "b"}
-! CHECK: acc.loop reduction(@reduction_add_ref_100x10xi32 -> %[[RED_ARG1]] : !fir.ref<!fir.array<100x10xi32>>) {
-! CHECK: } attributes {collapse = 2 : i64}
+! CHECK: acc.loop {{.*}} reduction(@reduction_add_ref_100x10xi32 -> %[[RED_ARG1]] : !fir.ref<!fir.array<100x10xi32>>)
+! CHECK: } attributes {collapse = 2 : i64{{.*}}}
subroutine acc_reduction_add_int_array_3d(a, b)
integer :: a(100, 10, 2), b(100, 10, 2)
@@ -575,8 +575,8 @@ subroutine acc_reduction_add_int_array_3d(a, b)
! CHECK-LABEL: func.func @_QPacc_reduction_add_int_array_3d(
! CHECK-SAME: %{{.*}}: !fir.ref<!fir.array<100x10x2xi32>> {fir.bindc_name = "a"}, %[[ARG1:.*]]: !fir.ref<!fir.array<100x10x2xi32>> {fir.bindc_name = "b"})
! CHECK: %[[RED_ARG1:.*]] = acc.reduction varPtr(%[[ARG1]] : !fir.ref<!fir.array<100x10x2xi32>>) bounds(%{{.*}}, %{{.*}}, %{{.*}}) -> !fir.ref<!fir.array<100x10x2xi32>> {name = "b"}
-! CHECK: acc.loop reduction(@reduction_add_ref_100x10x2xi32 -> %[[RED_ARG1]] : !fir.ref<!fir.array<100x10x2xi32>>)
-! CHECK: } attributes {collapse = 3 : i64}
+! CHECK: acc.loop {{.*}} reduction(@reduction_add_ref_100x10x2xi32 -> %[[RED_ARG1]] : !fir.ref<!fir.array<100x10x2xi32>>)
+! CHECK: } attributes {collapse = 3 : i64{{.*}}}
subroutine acc_reduction_add_float(a, b)
real :: a(100), b
@@ -591,7 +591,7 @@ subroutine acc_reduction_add_float(a, b)
! CHECK-LABEL: func.func @_QPacc_reduction_add_float(
! CHECK-SAME: %{{.*}}: !fir.ref<!fir.array<100xf32>> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref<f32> {fir.bindc_name = "b"})
! CHECK: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref<f32>) -> !fir.ref<f32> {name = "b"}
-! CHECK: acc.loop reduction(@reduction_add_ref_f32 -> %[[RED_B]] : !fir.ref<f32>)
+! CHECK: acc.loop {{.*}} reduction(@reduction_add_ref_f32 -> %[[RED_B]] : !fir.ref<f32>)
subroutine acc_reduction_add_float_array_1d(a, b)
real :: a(100), b(100)
@@ -606,7 +606,7 @@ subroutine acc_reduction_add_float_array_1d(a, b)
! CHECK-LABEL: func.func @_QPacc_reduction_add_float_array_1d(
! CHECK-SAME: %{{.*}}: !fir.ref<!fir.array<100xf32>> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref<!fir.array<100xf32>> {fir.bindc_name = "b"})
! CHECK: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref<!fir.array<100xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<100xf32>> {name = "b"}
-! CHECK: acc.loop reduction(@reduction_add_ref_100xf32 -> %[[RED_B]] : !fir.ref<!fir.array<100xf32>>)
+! CHECK: acc.loop {{.*}} reduction(@reduction_add_ref_100xf32 -> %[[RED_B]] : !fir.ref<!fir.array<100xf32>>)
subroutine acc_reduction_mul_int(a, b)
integer :: a(100)
@@ -621,7 +621,7 @@ subroutine acc_reduction_mul_int(a, b)
! CHECK-LABEL: func.func @_QPacc_reduction_mul_int(
! CHECK-SAME: %{{.*}}: !fir.ref<!fir.array<100xi32>> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref<i32> {fir.bindc_name = "b"})
! CHECK: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref<i32>) -> !fir.ref<i32> {name = "b"}
-! CHECK: acc.loop reduction(@reduction_mul_ref_i32 -> %[[RED_B]] : !fir.ref<i32>)
+! CHECK: acc.loop {{.*}} reduction(@reduction_mul_ref_i32 -> %[[RED_B]] : !fir.ref<i32>)
subroutine acc_reduction_mul_int_array_1d(a, b)
integer :: a(100)
@@ -636,7 +636,7 @@ subroutine acc_reduction_mul_int_array_1d(a, b)
! CHECK-LABEL: func.func @_QPacc_reduction_mul_int_array_1d(
! CHECK-SAME: %{{.*}}: !fir.ref<!fir.array<100xi32>> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref<!fir.array<100xi32>> {fir.bindc_name = "b"})
! CHECK: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref<!fir.array<100xi32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<100xi32>> {name = "b"}
-! CHECK: acc.loop reduction(@reduction_mul_ref_100xi32 -> %[[RED_B]] : !fir.ref<!fir.array<100xi32>>)
+! CHECK: acc.loop {{.*}} reduction(@reduction_mul_ref_100xi32 -> %[[RED_B]] : !fir.ref<!fir.array<100xi32>>)
subroutine acc_reduction_mul_float(a, b)
real :: a(100), b
@@ -651,7 +651,7 @@ subroutine acc_reduction_mul_float(a, b)
! CHECK-LABEL: func.func @_QPacc_reduction_mul_float(
! CHECK-SAME: %{{.*}}: !fir.ref<!fir.array<100xf32>> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref<f32> {fir.bindc_name = "b"})
! CHECK: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref<f32>) -> !fir.ref<f32> {name = "b"}
-! CHECK: acc.loop reduction(@reduction_mul_ref_f32 -> %[[RED_B]] : !fir.ref<f32>)
+! CHECK: acc.loop {{.*}} reduction(@reduction_mul_ref_f32 -> %[[RED_B]] : !fir.ref<f32>)
subroutine acc_reduction_mul_float_array_1d(a, b)
real :: a(100), b(100)
@@ -665,8 +665,8 @@ subroutine acc_reduction_mul_float_array_1d(a, b)
! CHECK-LABEL: func.func @_QPacc_reduction_mul_float_array_1d(
! CHECK-SAME: %{{.*}}: !fir.ref<!fir.array<100xf32>> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref<!fir.array<100xf32>> {fir.bindc_name = "b"})
-! CHECK: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref<!fir.array<100xf32>>) bounds(%2) -> !fir.ref<!fir.array<100xf32>> {name = "b"}
-! CHECK: acc.loop reduction(@reduction_mul_ref_100xf32 -> %[[RED_B]] : !fir.ref<!fir.array<100xf32>>)
+! CHECK: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref<!fir.array<100xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<100xf32>> {name = "b"}
+! CHECK: acc.loop {{.*}} reduction(@reduction_mul_ref_100xf32 -> %[[RED_B]] : !fir.ref<!fir.array<100xf32>>)
subroutine acc_reduction_min_int(a, b)
integer :: a(100)
@@ -681,7 +681,7 @@ subroutine acc_reduction_min_int(a, b)
! CHECK-LABEL: func.func @_QPacc_reduction_min_int(
! CHECK-SAME: %{{.*}}: !fir.ref<!fir.array<100xi32>> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref<i32> {fir.bindc_name = "b"})
! CHECK: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref<i32>) -> !fir.ref<i32> {name = "b"}
-! CHECK: acc.loop reduction(@reduction_min_ref_i32 -> %[[RED_B]] : !fir.ref<i32>)
+! CHECK: acc.loop {{.*}} reduction(@reduction_min_ref_i32 -> %[[RED_B]] : !fir.ref<i32>)
subroutine acc_reduction_min_int_array_1d(a, b)
integer :: a(100), b(100)
@@ -695,8 +695,8 @@ subroutine acc_reduction_min_int_array_1d(a, b)
! CHECK-LABEL: func.func @_QPacc_reduction_min_int_array_1d(
! CHECK-SAME: %{{.*}}: !fir.ref<!fir.array<100xi32>> {fir.bindc_name = "a"}, %[[ARG1:.*]]: !fir.ref<!fir.array<100xi32>> {fir.bindc_name = "b"})
-! CHECK: %[[RED_ARG1:.*]] = acc.reduction varPtr(%[[ARG1]] : !fir.ref<!fir.array<100xi32>>) bounds(%2) -> !fir.ref<!fir.array<100xi32>> {name = "b"}
-! CHECK: acc.loop reduction(@reduction_min_ref_100xi32 -> %[[RED_ARG1]] : !fir.ref<!fir.array<100xi32>>)
+! CHECK: %[[RED_ARG1:.*]] = acc.reduction varPtr(%[[ARG1]] : !fir.ref<!fir.array<100xi32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<100xi32>> {name = "b"}
+! CHECK: acc.loop {{.*}} reduction(@reduction_min_ref_100xi32 -> %[[RED_ARG1]] : !fir.ref<!fir.array<100xi32>>)
subroutine acc_reduction_min_float(a, b)
real :: a(100), b
@@ -711,7 +711,7 @@ subroutine acc_reduction_min_float(a, b)
! CHECK-LABEL: func.func @_QPacc_reduction_min_float(
! CHECK-SAME: %{{.*}}: !fir.ref<!fir.array<100xf32>> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref<f32> {fir.bindc_name = "b"})
! CHECK: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref<f32>) -> !fir.ref<f32> {name = "b"}
-! CHECK: acc.loop reduction(@reduction_min_ref_f32 -> %[[RED_B]] : !fir.ref<f32>)
+! CHECK: acc.loop {{.*}} reduction(@reduction_min_ref_f32 -> %[[RED_B]] : !fir.ref<f32>)
subroutine acc_reduction_min_float_array2d(a, b)
real :: a(100, 10), b(100, 10)
@@ -727,9 +727,9 @@ subroutine acc_reduction_min_float_array2d(a, b)
! CHECK-LABEL: func.func @_QPacc_reduction_min_float_array2d(
! CHECK-SAME: %{{.*}}: !fir.ref<!fir.array<100x10xf32>> {fir.bindc_name = "a"}, %[[ARG1:.*]]: !fir.ref<!fir.array<100x10xf32>> {fir.bindc_name = "b"})
-! CHECK: %[[RED_ARG1:.*]] = acc.reduction varPtr(%[[ARG1]] : !fir.ref<!fir.array<100x10xf32>>) bounds(%3, %5) -> !fir.ref<!fir.array<100x10xf32>> {name = "b"}
-! CHECK: acc.loop reduction(@reduction_min_ref_100x10xf32 -> %[[RED_ARG1]] : !fir.ref<!fir.array<100x10xf32>>)
-! CHECK: attributes {collapse = 2 : i64}
+! CHECK: %[[RED_ARG1:.*]] = acc.reduction varPtr(%[[ARG1]] : !fir.ref<!fir.array<100x10xf32>>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref<!fir.array<100x10xf32>> {name = "b"}
+! CHECK: acc.loop {{.*}} reduction(@reduction_min_ref_100x10xf32 -> %[[RED_ARG1]] : !fir.ref<!fir.array<100x10xf32>>)
+! CHECK: attributes {collapse = 2 : i64{{.*}}}
subroutine acc_reduction_max_int(a, b)
integer :: a(100)
@@ -744,7 +744,7 @@ subroutine acc_reduction_max_int(a, b)
! CHECK-LABEL: func.func @_QPacc_reduction_max_int(
! CHECK-SAME: %{{.*}}: !fir.ref<!fir.array<100xi32>> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref<i32> {fir.bindc_name = "b"})
! CHECL: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref<i32>) -> !fir.ref<i32> {name = "b"}
-! CHECK: acc.loop reduction(@reduction_max_ref_i32 -> %[[RED_B]] : !fir.ref<i32>)
+! CHECK: acc.loop {{.*}} reduction(@reduction_max_ref_i32 -> %[[RED_B]] : !fir.ref<i32>)
subroutine acc_reduction_max_int_array2d(a, b)
integer :: a(100, 10), b(100, 10)
@@ -761,7 +761,7 @@ subroutine acc_reduction_max_int_array2d(a, b)
! CHECK-LABEL: func.func @_QPacc_reduction_max_int_array2d(
! CHECK-SAME: %{{.*}}: !fir.ref<!fir.array<100x10xi32>> {fir.bindc_name = "a"}, %[[ARG1:.*]]: !fir.ref<!fir.array<100x10xi32>> {fir.bindc_name = "b"})
! CHECK: %[[RED_ARG1:.*]] = acc.reduction varPtr(%[[ARG1]] : !fir.ref<!fir.array<100x10xi32>>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref<!fir.array<100x10xi32>> {name = "b"}
-! CHECK: acc.loop reduction(@reduction_max_ref_100x10xi32 -> %[[RED_ARG1]] : !fir.ref<!fir.array<100x10xi32>>)
+! CHECK: acc.loop {{.*}} reduction(@reduction_max_ref_100x10xi32 -> %[[RED_ARG1]] : !fir.ref<!fir.array<100x10xi32>>)
subroutine acc_reduction_max_float(a, b)
real :: a(100), b
@@ -776,7 +776,7 @@ subroutine acc_reduction_max_float(a, b)
! CHECK-LABEL: func.func @_QPacc_reduction_max_float(
! CHECK-SAME: %{{.*}}: !fir.ref<!fir.array<100xf32>> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref<f32> {fir.bindc_name = "b"})
! CHECK: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref<f32>) -> !fir.ref<f32> {name = "b"}
-! CHECK: acc.loop reduction(@reduction_max_ref_f32 -> %[[RED_B]] : !fir.ref<f32>)
+! CHECK: acc.loop {{.*}} reduction(@reduction_max_ref_f32 -> %[[RED_B]] : !fir.ref<f32>)
subroutine acc_reduction_max_float_array1d(a, b)
real :: a(100), b(100)
@@ -791,7 +791,7 @@ subroutine acc_reduction_max_float_array1d(a, b)
! CHECK-LABEL: func.func @_QPacc_reduction_max_float_array1d(
! CHECK-SAME: %{{.*}}: !fir.ref<!fir.array<100xf32>> {fir.bindc_name = "a"}, %[[ARG1:.*]]: !fir.ref<!fir.array<100xf32>> {fir.bindc_name = "b"})
! CHECK: %[[RED_ARG1:.*]] = acc.reduction varPtr(%[[ARG1]] : !fir.ref<!fir.array<100xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<100xf32>> {name = "b"}
-! CHECK: acc.loop reduction(@reduction_max_ref_100xf32 -> %[[RED_ARG1]] : !fir.ref<!fir.array<100xf32>>) {
+! CHECK: acc.loop {{.*}} reduction(@reduction_max_ref_100xf32 -> %[[RED_ARG1]] : !fir.ref<!fir.array<100xf32>>)
subroutine acc_reduction_iand()
integer :: i
diff --git a/flang/test/Lower/OpenACC/acc-serial-loop.f90 b/flang/test/Lower/OpenACC/acc-serial-loop.f90
index a3fe901a73ce49..0273a7e6d29fdc 100644
--- a/flang/test/Lower/OpenACC/acc-serial-loop.f90
+++ b/flang/test/Lower/OpenACC/acc-serial-loop.f90
@@ -53,8 +53,7 @@ subroutine acc_serial_loop
END DO
! CHECK: acc.serial {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -67,8 +66,7 @@ subroutine acc_serial_loop
!$acc end serial loop
! CHECK: acc.serial {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -81,8 +79,7 @@ subroutine acc_serial_loop
! CHECK: [[ASYNC1:%.*]] = arith.constant 1 : i32
! CHECK: acc.serial async([[ASYNC1]] : i32) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -95,8 +92,7 @@ subroutine acc_serial_loop
! CHECK: [[ASYNC2:%.*]] = fir.load %{{.*}} : !fir.ref<i32>
! CHECK: acc.serial async([[ASYNC2]] : i32) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -108,8 +104,7 @@ subroutine acc_serial_loop
END DO
! CHECK: acc.serial {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -122,8 +117,7 @@ subroutine acc_serial_loop
! CHECK: [[WAIT1:%.*]] = arith.constant 1 : i32
! CHECK: acc.serial wait([[WAIT1]] : i32) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -137,8 +131,7 @@ subroutine acc_serial_loop
! CHECK: [[WAIT2:%.*]] = arith.constant 1 : i32
! CHECK: [[WAIT3:%.*]] = arith.constant 2 : i32
! CHECK: acc.serial wait([[WAIT2]], [[WAIT3]] : i32, i32) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -152,8 +145,7 @@ subroutine acc_serial_loop
! CHECK: [[WAIT4:%.*]] = fir.load %{{.*}} : !fir.ref<i32>
! CHECK: [[WAIT5:%.*]] = fir.load %{{.*}} : !fir.ref<i32>
! CHECK: acc.serial wait([[WAIT4]], [[WAIT5]] : i32, i32) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -166,8 +158,7 @@ subroutine acc_serial_loop
! CHECK: [[IF1:%.*]] = arith.constant true
! CHECK: acc.serial if([[IF1]]) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -181,8 +172,7 @@ subroutine acc_serial_loop
! CHECK: [[IFCOND:%.*]] = fir.load %{{.*}} : !fir.ref<!fir.logical<4>>
! CHECK: [[IF2:%.*]] = fir.convert [[IFCOND]] : (!fir.logical<4>) -> i1
! CHECK: acc.serial if([[IF2]]) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -195,8 +185,7 @@ subroutine acc_serial_loop
! CHECK: [[SELF1:%.*]] = arith.constant true
! CHECK: acc.serial self([[SELF1]]) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -208,8 +197,7 @@ subroutine acc_serial_loop
END DO
! CHECK: acc.serial {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -222,8 +210,7 @@ subroutine acc_serial_loop
! CHECK: %[[SELF2:.*]] = fir.convert %[[IFCONDITION]] : (!fir.ref<!fir.logical<4>>) -> i1
! CHECK: acc.serial self(%[[SELF2]]) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -237,8 +224,7 @@ subroutine acc_serial_loop
! CHECK: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {dataClause = #acc<data_clause acc_copy>, name = "a"}
! CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {dataClause = #acc<data_clause acc_copy>, name = "b"}
! CHECK: acc.serial dataOperands(%[[COPYIN_A]], %[[COPYIN_B]] : !fir.ref<!fir.array<10xf32>>, !fir.ref<!fir.array<10xf32>>) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -254,8 +240,7 @@ subroutine acc_serial_loop
! CHECK: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {dataClause = #acc<data_clause acc_copy>, name = "a"}
! CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {dataClause = #acc<data_clause acc_copy>, name = "b"}
! CHECK: acc.serial dataOperands(%[[COPYIN_A]], %[[COPYIN_B]] : !fir.ref<!fir.array<10xf32>>, !fir.ref<!fir.array<10xf32>>) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -271,8 +256,7 @@ subroutine acc_serial_loop
! CHECK: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[A]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {name = "a"}
! CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[B]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {dataClause = #acc<data_clause acc_copyin_readonly>, name = "b"}
! CHECK: acc.serial dataOperands(%[[COPYIN_A]], %[[COPYIN_B]] : !fir.ref<!fir.array<10xf32>>, !fir.ref<!fir.array<10xf32>>) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -286,8 +270,7 @@ subroutine acc_serial_loop
! CHECK: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {dataClause = #acc<data_clause acc_copyout>, name = "a"}
! CHECK: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {dataClause = #acc<data_clause acc_copyout>, name = "b"}
! CHECK: acc.serial dataOperands(%[[CREATE_A]], %[[CREATE_B]] : !fir.ref<!fir.array<10xf32>>, !fir.ref<!fir.array<10xf32>>) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -303,8 +286,7 @@ subroutine acc_serial_loop
! CHECK: %[[CREATE_B:.*]] = acc.create varPtr(%[[B]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {name = "b"}
! CHECK: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {dataClause = #acc<data_clause acc_create_zero>, name = "a"}
! CHECK: acc.serial dataOperands(%[[CREATE_B]], %[[CREATE_A]] : !fir.ref<!fir.array<10xf32>>, !fir.ref<!fir.array<10xf32>>) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -320,8 +302,7 @@ subroutine acc_serial_loop
! CHECK: %[[NOCREATE_A:.*]] = acc.nocreate varPtr(%[[A]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {name = "a"}
! CHECK: %[[NOCREATE_B:.*]] = acc.nocreate varPtr(%[[B]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {name = "b"}
! CHECK: acc.serial dataOperands(%[[NOCREATE_A]], %[[NOCREATE_B]] : !fir.ref<!fir.array<10xf32>>, !fir.ref<!fir.array<10xf32>>) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -335,8 +316,7 @@ subroutine acc_serial_loop
! CHECK: %[[PRESENT_A:.*]] = acc.present varPtr(%[[A]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {name = "a"}
! CHECK: %[[PRESENT_B:.*]] = acc.present varPtr(%[[B]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {name = "b"}
! CHECK: acc.serial dataOperands(%[[PRESENT_A]], %[[PRESENT_B]] : !fir.ref<!fir.array<10xf32>>, !fir.ref<!fir.array<10xf32>>) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -350,8 +330,7 @@ subroutine acc_serial_loop
! CHECK: %[[DEVICEPTR_A:.*]] = acc.deviceptr varPtr(%[[A]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {name = "a"}
! CHECK: %[[DEVICEPTR_B:.*]] = acc.deviceptr varPtr(%[[B]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {name = "b"}
! CHECK: acc.serial dataOperands(%[[DEVICEPTR_A]], %[[DEVICEPTR_B]] : !fir.ref<!fir.array<10xf32>>, !fir.ref<!fir.array<10xf32>>) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -369,8 +348,7 @@ subroutine acc_serial_loop
! CHECK: %[[BOX_ADDR_G:.*]] = fir.box_addr %[[BOX_G]] : (!fir.box<!fir.ptr<f32>>) -> !fir.ptr<f32>
! CHECK: %[[ATTACH_G:.*]] = acc.attach varPtr(%[[BOX_ADDR_G]] : !fir.ptr<f32>) -> !fir.ptr<f32> {name = "g"}
! CHECK: acc.serial dataOperands(%[[ATTACH_F]], %[[ATTACH_G]] : !fir.ptr<f32>, !fir.ptr<f32>) {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -385,8 +363,7 @@ subroutine acc_serial_loop
! CHECK: %[[ACC_FPRIVATE_B:.*]] = acc.firstprivate varPtr(%[[B]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {name = "b"}
! CHECK: acc.serial firstprivate(@firstprivatization_ref_10xf32 -> %[[ACC_FPRIVATE_B]] : !fir.ref<!fir.array<10xf32>>) private(@privatization_ref_10xf32 -> %[[ACC_PRIVATE_A]] : !fir.ref<!fir.array<10xf32>>) {
! CHECK: %[[ACC_PRIVATE_A:.*]] = acc.private varPtr(%[[A]] : !fir.ref<!fir.array<10xf32>>) bounds(%{{.*}}) -> !fir.ref<!fir.array<10xf32>> {name = "a"}
-! CHECK: acc.loop private(@privatization_ref_10xf32 -> %[[ACC_PRIVATE_A]] : !fir.ref<!fir.array<10xf32>>) {
-! CHECK: fir.do_loop
+! CHECK: acc.loop private(@privatization_ref_i32 -> %{{.*}} : !fir.ref<i32>, @privatization_ref_10xf32 -> %[[ACC_PRIVATE_A]] : !fir.ref<!fir.array<10xf32>>) {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -398,10 +375,9 @@ subroutine acc_serial_loop
END DO
! CHECK: acc.serial {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
-! CHECK-NEXT: } attributes {seq}
+! CHECK-NEXT: } attributes {inclusiveUpperbound = array<i1: true>, seq}
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
@@ -411,10 +387,9 @@ subroutine acc_serial_loop
END DO
! CHECK: acc.serial {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
-! CHECK-NEXT: } attributes {auto}
+! CHECK-NEXT: } attributes {auto, inclusiveUpperbound = array<i1: true>}
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
@@ -424,10 +399,9 @@ subroutine acc_serial_loop
END DO
! CHECK: acc.serial {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
-! CHECK-NEXT: } attributes {independent}
+! CHECK-NEXT: } attributes {inclusiveUpperbound = array<i1: true>, independent}
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
@@ -437,8 +411,7 @@ subroutine acc_serial_loop
END DO
! CHECK: acc.serial {
-! CHECK: acc.loop gang {
-! CHECK: fir.do_loop
+! CHECK: acc.loop gang() {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -451,8 +424,7 @@ subroutine acc_serial_loop
! CHECK: acc.serial {
! CHECK: [[GANGNUM1:%.*]] = arith.constant 8 : i32
-! CHECK-NEXT: acc.loop gang(num=[[GANGNUM1]] : i32) {
-! CHECK: fir.do_loop
+! CHECK-NEXT: acc.loop gang(num=[[GANGNUM1]] : i32) {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -465,8 +437,7 @@ subroutine acc_serial_loop
! CHECK: acc.serial {
! CHECK: [[GANGNUM2:%.*]] = fir.load %{{.*}} : !fir.ref<i32>
-! CHECK-NEXT: acc.loop gang(num=[[GANGNUM2]] : i32) {
-! CHECK: fir.do_loop
+! CHECK-NEXT: acc.loop gang(num=[[GANGNUM2]] : i32) {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -478,8 +449,7 @@ subroutine acc_serial_loop
END DO
! CHECK: acc.serial {
-! CHECK: acc.loop gang(num=%{{.*}} : i32, static=%{{.*}} : i32) {
-! CHECK: fir.do_loop
+! CHECK: acc.loop gang(num=%{{.*}} : i32, static=%{{.*}} : i32) {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -490,8 +460,7 @@ subroutine acc_serial_loop
a(i) = b(i)
END DO
! CHECK: acc.serial {
-! CHECK: acc.loop vector {
-! CHECK: fir.do_loop
+! CHECK: acc.loop vector() {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -504,8 +473,7 @@ subroutine acc_serial_loop
! CHECK: acc.serial {
! CHECK: [[CONSTANT128:%.*]] = arith.constant 128 : i32
-! CHECK: acc.loop vector([[CONSTANT128]] : i32) {
-! CHECK: fir.do_loop
+! CHECK: acc.loop vector([[CONSTANT128]] : i32) {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -518,8 +486,7 @@ subroutine acc_serial_loop
! CHECK: acc.serial {
! CHECK: [[VECTORLENGTH:%.*]] = fir.load %{{.*}} : !fir.ref<i32>
-! CHECK: acc.loop vector([[VECTORLENGTH]] : i32) {
-! CHECK: fir.do_loop
+! CHECK: acc.loop vector([[VECTORLENGTH]] : i32) {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -531,8 +498,7 @@ subroutine acc_serial_loop
END DO
! CHECK: acc.serial {
-! CHECK: acc.loop worker {
-! CHECK: fir.do_loop
+! CHECK: acc.loop worker() {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -545,8 +511,7 @@ subroutine acc_serial_loop
! CHECK: acc.serial {
! CHECK: [[WORKER128:%.*]] = arith.constant 128 : i32
-! CHECK: acc.loop worker([[WORKER128]] : i32) {
-! CHECK: fir.do_loop
+! CHECK: acc.loop worker([[WORKER128]] : i32) {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -560,11 +525,10 @@ subroutine acc_serial_loop
END DO
! CHECK: acc.serial {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
! CHECK: fir.do_loop
! CHECK: acc.yield
-! CHECK-NEXT: } attributes {collapse = 2 : i64}
+! CHECK-NEXT: } attributes {collapse = 2 : i64, inclusiveUpperbound = array<i1: true, true>}
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
@@ -577,10 +541,8 @@ subroutine acc_serial_loop
END DO
! CHECK: acc.serial {
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
-! CHECK: acc.loop {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} {
+! CHECK: acc.loop {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -595,8 +557,7 @@ subroutine acc_serial_loop
! CHECK: acc.serial {
! CHECK: [[TILESIZE:%.*]] = arith.constant 2 : i32
-! CHECK: acc.loop tile([[TILESIZE]] : i32) {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} tile([[TILESIZE]] : i32) {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -609,8 +570,7 @@ subroutine acc_serial_loop
! CHECK: acc.serial {
! CHECK: [[TILESIZEM1:%.*]] = arith.constant -1 : i32
-! CHECK: acc.loop tile([[TILESIZEM1]] : i32) {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} tile([[TILESIZEM1]] : i32) {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -626,8 +586,7 @@ subroutine acc_serial_loop
! CHECK: acc.serial {
! CHECK: [[TILESIZE1:%.*]] = arith.constant 2 : i32
! CHECK: [[TILESIZE2:%.*]] = arith.constant 2 : i32
-! CHECK: acc.loop tile([[TILESIZE1]], [[TILESIZE2]] : i32, i32) {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} tile([[TILESIZE1]], [[TILESIZE2]] : i32, i32) {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -639,8 +598,7 @@ subroutine acc_serial_loop
END DO
! CHECK: acc.serial {
-! CHECK: acc.loop tile(%{{.*}} : i32) {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} tile(%{{.*}} : i32) {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -654,8 +612,7 @@ subroutine acc_serial_loop
END DO
! CHECK: acc.serial {
-! CHECK: acc.loop tile(%{{.*}}, %{{.*}} : i32, i32) {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} tile(%{{.*}}, %{{.*}} : i32, i32) {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
@@ -668,8 +625,7 @@ subroutine acc_serial_loop
end do
! CHECK: acc.serial reduction(@reduction_add_ref_f32 -> %{{.*}} : !fir.ref<f32>, @reduction_mul_ref_i32 -> %{{.*}} : !fir.ref<i32>) {
-! CHECK: acc.loop reduction(@reduction_add_ref_f32 -> %{{.*}} : !fir.ref<f32>, @reduction_mul_ref_i32 -> %{{.*}} : !fir.ref<i32>) {
-! CHECK: fir.do_loop
+! CHECK: acc.loop {{.*}} reduction(@reduction_add_ref_f32 -> %{{.*}} : !fir.ref<f32>, @reduction_mul_ref_i32 -> %{{.*}} : !fir.ref<i32>) {{.*}} {
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
! CHECK: acc.yield
>From dc414e4cbb2031256105ad5b80124b6f3c66769d Mon Sep 17 00:00:00 2001
From: Valentin Clement <clementval at gmail.com>
Date: Wed, 6 Sep 2023 09:49:11 -0700
Subject: [PATCH 2/4] Set iv values
---
flang/lib/Lower/OpenACC.cpp | 6 +++---
flang/test/Lower/OpenACC/acc-loop.f90 | 2 ++
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/flang/lib/Lower/OpenACC.cpp b/flang/lib/Lower/OpenACC.cpp
index a0b884e6ba7e6b..29468b6d59e994 100644
--- a/flang/lib/Lower/OpenACC.cpp
+++ b/flang/lib/Lower/OpenACC.cpp
@@ -1532,9 +1532,9 @@ createLoopOp(Fortran::lower::AbstractConverter &converter,
auto loopOp = createRegionOp<mlir::acc::LoopOp, mlir::acc::YieldOp>(
builder, currentLocation, operands, operandSegments, ivTypes, ivLocs);
- builder.create<fir::StoreOp>(currentLocation,
- loopOp.getLoopBody().front().getArguments()[0],
- ivPrivate[0]);
+ for (auto [arg, value] :
+ llvm::zip(loopOp.getLoopBody().front().getArguments(), ivPrivate))
+ builder.create<fir::StoreOp>(currentLocation, arg, value);
loopOp.setInclusiveUpperbound(inclusiveBounds);
diff --git a/flang/test/Lower/OpenACC/acc-loop.f90 b/flang/test/Lower/OpenACC/acc-loop.f90
index 78897354f90350..435e644bda2fb5 100644
--- a/flang/test/Lower/OpenACC/acc-loop.f90
+++ b/flang/test/Lower/OpenACC/acc-loop.f90
@@ -231,6 +231,8 @@ program acc_loop
END DO
! CHECK: acc.loop {{.*}} (%arg0 : i32, %arg1 : i32) = (%{{.*}} : i32, i32) to (%{{.*}} : i32, i32) step (%{{.*}} : i32, i32) {
+! CHECK: fir.store %arg0 to %{{.*}} : !fir.ref<i32>
+! CHECK: fir.store %arg1 to %{{.*}} : !fir.ref<i32>
! CHECK: acc.yield
! CHECK-NEXT: } attributes {collapse = 2 : i64, inclusiveUpperbound = array<i1: true, true>}
>From 40c2a7beefb6f830fae7d4368cc6382cf058607d Mon Sep 17 00:00:00 2001
From: Valentin Clement <clementval at gmail.com>
Date: Thu, 7 Sep 2023 11:01:49 -0700
Subject: [PATCH 3/4] Address comments
---
flang/lib/Lower/OpenACC.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/flang/lib/Lower/OpenACC.cpp b/flang/lib/Lower/OpenACC.cpp
index 29468b6d59e994..8c00fa70923646 100644
--- a/flang/lib/Lower/OpenACC.cpp
+++ b/flang/lib/Lower/OpenACC.cpp
@@ -1350,6 +1350,7 @@ mlir::Type getTypeFromIvTypeSize(fir::FirOpBuilder &builder,
std::size_t ivTypeSize = ivSym.size();
if (ivTypeSize == 0)
llvm::report_fatal_error("unexpected induction variable size");
+ // ivTypeSize is in bytes and IntegerType needs to be in bits.
return builder.getIntegerType(ivTypeSize * 8);
}
@@ -1405,7 +1406,7 @@ createLoopOp(Fortran::lower::AbstractConverter &converter,
*Fortran::semantics::GetExpr(bounds->step), stmtCtx)));
else // If `step` is not present, assume it as `1`.
steps.push_back(builder.createIntegerConstant(
- currentLocation, builder.getIntegerType(32), 1));
+ currentLocation, upperbounds[upperbounds.size()-1].getType(), 1));
Fortran::semantics::Symbol &ivSym =
bounds->name.thing.symbol->GetUltimate();
@@ -1597,8 +1598,7 @@ static void genACC(Fortran::lower::AbstractConverter &converter,
converter.genLocation(beginLoopDirective.source);
Fortran::lower::StatementContext stmtCtx;
- if (loopDirective.v != llvm::acc::ACCD_loop)
- llvm::report_fatal_error("Unsupported OpenACC loop construct");
+ assert(loopDirective.v == llvm::acc::ACCD_loop && "Unsupported OpenACC loop construct");
const auto &accClauseList =
std::get<Fortran::parser::AccClauseList>(beginLoopDirective.t);
>From 678b9c4fdc9f009d7dec6abf3f8e5323b040ee4b Mon Sep 17 00:00:00 2001
From: Valentin Clement <clementval at gmail.com>
Date: Thu, 7 Sep 2023 11:02:44 -0700
Subject: [PATCH 4/4] Apply clang-format
---
flang/lib/Lower/OpenACC.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/flang/lib/Lower/OpenACC.cpp b/flang/lib/Lower/OpenACC.cpp
index 8c00fa70923646..71725742dccc71 100644
--- a/flang/lib/Lower/OpenACC.cpp
+++ b/flang/lib/Lower/OpenACC.cpp
@@ -1406,7 +1406,7 @@ createLoopOp(Fortran::lower::AbstractConverter &converter,
*Fortran::semantics::GetExpr(bounds->step), stmtCtx)));
else // If `step` is not present, assume it as `1`.
steps.push_back(builder.createIntegerConstant(
- currentLocation, upperbounds[upperbounds.size()-1].getType(), 1));
+ currentLocation, upperbounds[upperbounds.size() - 1].getType(), 1));
Fortran::semantics::Symbol &ivSym =
bounds->name.thing.symbol->GetUltimate();
@@ -1598,7 +1598,8 @@ static void genACC(Fortran::lower::AbstractConverter &converter,
converter.genLocation(beginLoopDirective.source);
Fortran::lower::StatementContext stmtCtx;
- assert(loopDirective.v == llvm::acc::ACCD_loop && "Unsupported OpenACC loop construct");
+ assert(loopDirective.v == llvm::acc::ACCD_loop &&
+ "Unsupported OpenACC loop construct");
const auto &accClauseList =
std::get<Fortran::parser::AccClauseList>(beginLoopDirective.t);
More information about the flang-commits
mailing list