Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions flang/lib/Lower/OpenACC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2712,12 +2712,19 @@ genACC(Fortran::lower::AbstractConverter &converter,
const auto &loopDirective =
std::get<Fortran::parser::AccLoopDirective>(beginLoopDirective.t);

mlir::Location currentLocation =
converter.genLocation(beginLoopDirective.source);
bool needEarlyExitHandling = false;
if (eval.lowerAsUnstructured())
if (eval.lowerAsUnstructured()) {
needEarlyExitHandling = hasEarlyReturn(eval);
// If the loop is lowered in an unstructured fashion, lowering generates
// explicit control flow that duplicates the looping semantics of the
// loops.
if (!needEarlyExitHandling)
TODO(currentLocation,
"loop with early exit inside OpenACC loop construct");
}

mlir::Location currentLocation =
converter.genLocation(beginLoopDirective.source);
Fortran::lower::StatementContext stmtCtx;

assert(loopDirective.v == llvm::acc::ACCD_loop &&
Expand Down Expand Up @@ -3516,6 +3523,10 @@ genACC(Fortran::lower::AbstractConverter &converter,
converter.genLocation(beginCombinedDirective.source);
Fortran::lower::StatementContext stmtCtx;

if (eval.lowerAsUnstructured())
TODO(currentLocation,
"loop with early exit inside OpenACC combined construct");

if (combinedDirective.v == llvm::acc::ACCD_kernels_loop) {
createComputeOp<mlir::acc::KernelsOp>(
converter, currentLocation, eval, semanticsContext, stmtCtx,
Expand Down
1 change: 1 addition & 0 deletions flang/test/Lower/OpenACC/acc-unstructured.f90
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s
! XFAIL: *

subroutine test_unstructured1(a, b, c)
integer :: i, j, k
Expand Down