diff --git a/flang/lib/Lower/OpenACC.cpp b/flang/lib/Lower/OpenACC.cpp index 8155c36396b11..86d8a549331fb 100644 --- a/flang/lib/Lower/OpenACC.cpp +++ b/flang/lib/Lower/OpenACC.cpp @@ -2183,8 +2183,9 @@ static Op createComputeOp( mlir::Value ifCond; mlir::Value selfCond; llvm::SmallVector waitOperands, attachEntryOperands, - copyEntryOperands, copyoutEntryOperands, createEntryOperands, - dataClauseOperands, numGangs, numWorkers, vectorLength, async; + copyEntryOperands, copyinEntryOperands, copyoutEntryOperands, + createEntryOperands, dataClauseOperands, numGangs, numWorkers, + vectorLength, async; llvm::SmallVector numGangsDeviceTypes, numWorkersDeviceTypes, vectorLengthDeviceTypes, asyncDeviceTypes, asyncOnlyDeviceTypes, waitOperandsDeviceTypes, waitOnlyDeviceTypes; @@ -2321,6 +2322,7 @@ static Op createComputeOp( dataClauseOperands.end()); } else if (const auto *copyinClause = std::get_if(&clause.u)) { + auto crtDataStart = dataClauseOperands.size(); genDataOperandOperationsWithModifier( copyinClause, converter, semanticsContext, stmtCtx, @@ -2328,6 +2330,8 @@ static Op createComputeOp( dataClauseOperands, mlir::acc::DataClause::acc_copyin, mlir::acc::DataClause::acc_copyin_readonly, async, asyncDeviceTypes, asyncOnlyDeviceTypes); + copyinEntryOperands.append(dataClauseOperands.begin() + crtDataStart, + dataClauseOperands.end()); } else if (const auto *copyoutClause = std::get_if( &clause.u)) { @@ -2525,6 +2529,8 @@ static Op createComputeOp( // Create the exit operations after the region. genDataExitOperations( builder, copyEntryOperands, /*structured=*/true); + genDataExitOperations( + builder, copyinEntryOperands, /*structured=*/true); genDataExitOperations( builder, copyoutEntryOperands, /*structured=*/true); genDataExitOperations( @@ -2544,8 +2550,8 @@ static void genACCDataOp(Fortran::lower::AbstractConverter &converter, const Fortran::parser::AccClauseList &accClauseList) { mlir::Value ifCond; llvm::SmallVector attachEntryOperands, createEntryOperands, - copyEntryOperands, copyoutEntryOperands, dataClauseOperands, waitOperands, - async; + copyEntryOperands, copyinEntryOperands, copyoutEntryOperands, + dataClauseOperands, waitOperands, async; llvm::SmallVector asyncDeviceTypes, asyncOnlyDeviceTypes, waitOperandsDeviceTypes, waitOnlyDeviceTypes; llvm::SmallVector waitOperandsSegments; @@ -2604,6 +2610,7 @@ static void genACCDataOp(Fortran::lower::AbstractConverter &converter, dataClauseOperands.end()); } else if (const auto *copyinClause = std::get_if(&clause.u)) { + auto crtDataStart = dataClauseOperands.size(); genDataOperandOperationsWithModifier( copyinClause, converter, semanticsContext, stmtCtx, @@ -2611,6 +2618,8 @@ static void genACCDataOp(Fortran::lower::AbstractConverter &converter, dataClauseOperands, mlir::acc::DataClause::acc_copyin, mlir::acc::DataClause::acc_copyin_readonly, async, asyncDeviceTypes, asyncOnlyDeviceTypes); + copyinEntryOperands.append(dataClauseOperands.begin() + crtDataStart, + dataClauseOperands.end()); } else if (const auto *copyoutClause = std::get_if( &clause.u)) { @@ -2723,6 +2732,8 @@ static void genACCDataOp(Fortran::lower::AbstractConverter &converter, // Create the exit operations after the region. genDataExitOperations( builder, copyEntryOperands, /*structured=*/true); + genDataExitOperations( + builder, copyinEntryOperands, /*structured=*/true); genDataExitOperations( builder, copyoutEntryOperands, /*structured=*/true); genDataExitOperations( @@ -3691,7 +3702,8 @@ genDeclareInFunction(Fortran::lower::AbstractConverter &converter, mlir::Location loc, const Fortran::parser::AccClauseList &accClauseList) { llvm::SmallVector dataClauseOperands, copyEntryOperands, - createEntryOperands, copyoutEntryOperands, deviceResidentEntryOperands; + copyinEntryOperands, createEntryOperands, copyoutEntryOperands, + deviceResidentEntryOperands; Fortran::lower::StatementContext stmtCtx; fir::FirOpBuilder &builder = converter.getFirOpBuilder(); @@ -3729,12 +3741,15 @@ genDeclareInFunction(Fortran::lower::AbstractConverter &converter, /*structured=*/true, /*implicit=*/false); } else if (const auto *copyinClause = std::get_if(&clause.u)) { + auto crtDataStart = dataClauseOperands.size(); genDeclareDataOperandOperationsWithModifier( copyinClause, converter, semanticsContext, stmtCtx, Fortran::parser::AccDataModifier::Modifier::ReadOnly, dataClauseOperands, mlir::acc::DataClause::acc_copyin, mlir::acc::DataClause::acc_copyin_readonly); + copyinEntryOperands.append(dataClauseOperands.begin() + crtDataStart, + dataClauseOperands.end()); } else if (const auto *copyoutClause = std::get_if( &clause.u)) { @@ -3801,12 +3816,14 @@ genDeclareInFunction(Fortran::lower::AbstractConverter &converter, } openAccCtx.attachCleanup([&builder, loc, createEntryOperands, - copyEntryOperands, copyoutEntryOperands, - deviceResidentEntryOperands, declareToken]() { + copyEntryOperands, copyinEntryOperands, + copyoutEntryOperands, deviceResidentEntryOperands, + declareToken]() { llvm::SmallVector operands; operands.append(createEntryOperands); operands.append(deviceResidentEntryOperands); operands.append(copyEntryOperands); + operands.append(copyinEntryOperands); operands.append(copyoutEntryOperands); mlir::func::FuncOp funcOp = builder.getFunction(); @@ -3825,6 +3842,8 @@ genDeclareInFunction(Fortran::lower::AbstractConverter &converter, builder, deviceResidentEntryOperands, /*structured=*/true); genDataExitOperations( builder, copyEntryOperands, /*structured=*/true); + genDataExitOperations( + builder, copyinEntryOperands, /*structured=*/true); genDataExitOperations( builder, copyoutEntryOperands, /*structured=*/true); }); @@ -3848,7 +3867,7 @@ genDeclareInModule(Fortran::lower::AbstractConverter &converter, } else if (const auto *copyinClause = std::get_if(&clause.u)) { genGlobalCtorsWithModifier( + mlir::acc::CopyinOp, mlir::acc::DeleteOp>( converter, modBuilder, copyinClause, Fortran::parser::AccDataModifier::Modifier::ReadOnly, mlir::acc::DataClause::acc_copyin, diff --git a/flang/test/Lower/OpenACC/acc-data-operands.f90 b/flang/test/Lower/OpenACC/acc-data-operands.f90 index 5151e8f6a135c..4341ea687070b 100644 --- a/flang/test/Lower/OpenACC/acc-data-operands.f90 +++ b/flang/test/Lower/OpenACC/acc-data-operands.f90 @@ -35,6 +35,7 @@ subroutine acc_operand_array_section() ! CHECK: acc.data dataOperands(%[[COPYIN]], %[[COPYOUT_CREATE]] : !fir.ref>, !fir.ref>) { ! CHECK: acc.terminator ! CHECK: } +! CHECK: acc.delete accPtr(%[[COPYIN]] : !fir.ref>) bounds(%[[BOUND_1_50]]) {dataClause = #acc, name = "a(1:50)"} ! CHECK: acc.copyout accPtr(%[[COPYOUT_CREATE]] : !fir.ref>) bounds(%[[BOUND_51_100]]) to varPtr(%[[DECL]]#0 : !fir.ref>) {name = "a(51:100)"} ! Testing array sections of a derived-type component @@ -138,9 +139,9 @@ subroutine acc_operand_array_section_allocatable() ! CHECK: %[[LOAD_BOX_A_2:.*]] = fir.load %[[DECLA]]#1 : !fir.ref>>> ! CHECK: %[[C0:.*]] = arith.constant 0 : index ! CHECK: %[[DIMS0_2:.*]]:3 = fir.box_dims %[[LOAD_BOX_A_2]], %[[C0]] : (!fir.box>>, index) -> (index, index, index) -! CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) extent(%[[DIMS0_2]]#1 : index) stride(%[[DIMS0_1]]#2 : index) startIdx(%[[DIMS0_0]]#0 : index) {strideInBytes = true} +! CHECK: %[[BOUND_1_50:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) extent(%[[DIMS0_2]]#1 : index) stride(%[[DIMS0_1]]#2 : index) startIdx(%[[DIMS0_0]]#0 : index) {strideInBytes = true} ! CHECK: %[[BOX_ADDR:.*]] = fir.box_addr %[[LOAD_BOX_A_0]] : (!fir.box>>) -> !fir.heap> -! CHECK: %[[COPYIN:.*]] = acc.copyin varPtr(%[[BOX_ADDR]] : !fir.heap>) bounds(%[[BOUND]]) -> !fir.heap> {name = "a(1:50)"} +! CHECK: %[[COPYIN:.*]] = acc.copyin varPtr(%[[BOX_ADDR]] : !fir.heap>) bounds(%[[BOUND_1_50]]) -> !fir.heap> {name = "a(1:50)"} ! CHECK: %[[LOAD_BOX_A_0:.*]] = fir.load %[[DECLA]]#0 : !fir.ref>>> ! CHECK: %[[LOAD_BOX_A_1:.*]] = fir.load %[[DECLA]]#1 : !fir.ref>>> ! CHECK: %[[C0:.*]] = arith.constant 0 : index @@ -154,13 +155,14 @@ subroutine acc_operand_array_section_allocatable() ! CHECK: %[[LOAD_BOX_A_2:.*]] = fir.load %[[DECLA]]#1 : !fir.ref>>> ! CHECK: %[[C0:.*]] = arith.constant 0 : index ! CHECK: %[[DIMS0_2:.*]]:3 = fir.box_dims %[[LOAD_BOX_A_2]], %[[C0]] : (!fir.box>>, index) -> (index, index, index) -! CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) extent(%[[DIMS0_2]]#1 : index) stride(%[[DIMS0_1]]#2 : index) startIdx(%[[DIMS0_0]]#0 : index) {strideInBytes = true} +! CHECK: %[[BOUND_51_100:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) extent(%[[DIMS0_2]]#1 : index) stride(%[[DIMS0_1]]#2 : index) startIdx(%[[DIMS0_0]]#0 : index) {strideInBytes = true} ! CHECK: %[[BOX_ADDR:.*]] = fir.box_addr %[[LOAD_BOX_A_0]] : (!fir.box>>) -> !fir.heap> -! CHECK: %[[COPYOUT_CREATE:.*]] = acc.create varPtr(%[[BOX_ADDR]] : !fir.heap>) bounds(%[[BOUND]]) -> !fir.heap> {dataClause = #acc, name = "a(51:100)"} +! CHECK: %[[COPYOUT_CREATE:.*]] = acc.create varPtr(%[[BOX_ADDR]] : !fir.heap>) bounds(%[[BOUND_51_100]]) -> !fir.heap> {dataClause = #acc, name = "a(51:100)"} ! CHECK: acc.data dataOperands(%[[COPYIN]], %[[COPYOUT_CREATE]] : !fir.heap>, !fir.heap>) { ! CHECK: acc.terminator ! CHECK: } -! CHECK: acc.copyout accPtr(%[[COPYOUT_CREATE]] : !fir.heap>) bounds(%[[BOUND]]) to varPtr(%[[BOX_ADDR]] : !fir.heap>) {name = "a(51:100)"} +! CHECK: acc.delete accPtr(%[[COPYIN]] : !fir.heap>) bounds(%[[BOUND_1_50]]) {dataClause = #acc, name = "a(1:50)"} +! CHECK: acc.copyout accPtr(%[[COPYOUT_CREATE]] : !fir.heap>) bounds(%[[BOUND_51_100]]) to varPtr(%[[BOX_ADDR]] : !fir.heap>) {name = "a(51:100)"} ! Testing array sections on pointer array @@ -196,6 +198,7 @@ subroutine acc_operand_array_section_pointer() ! CHECK: acc.data dataOperands(%[[COPYIN]] : !fir.ptr>) { ! CHECK: acc.terminator ! CHECK: } +! CHECK: acc.delete accPtr(%[[COPYIN]] : !fir.ptr>) bounds(%[[BOUND]]) {dataClause = #acc, name = "p(1:50)"} end module diff --git a/flang/test/Lower/OpenACC/acc-data.f90 b/flang/test/Lower/OpenACC/acc-data.f90 index 6e0ecb9129061..074f4d1135f10 100644 --- a/flang/test/Lower/OpenACC/acc-data.f90 +++ b/flang/test/Lower/OpenACC/acc-data.f90 @@ -74,6 +74,9 @@ subroutine acc_data ! CHECK: acc.data dataOperands(%[[COPYIN_A]], %[[COPYIN_B]], %[[COPYIN_C]] : !fir.ref>, !fir.ref>, !fir.ref>) { ! CHECK: acc.terminator ! CHECK-NEXT: }{{$}} +! CHECK: acc.delete accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) {dataClause = #acc, name = "a"} +! CHECK: acc.delete accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) {dataClause = #acc, name = "b"} +! CHECK: acc.delete accPtr(%[[COPYIN_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) {dataClause = #acc, name = "c"} !$acc data copyout(a) copyout(zero: b) copyout(c) !$acc end data diff --git a/flang/test/Lower/OpenACC/acc-declare-globals.f90 b/flang/test/Lower/OpenACC/acc-declare-globals.f90 index 1c54010dc108a..b64bbbcc0d12f 100644 --- a/flang/test/Lower/OpenACC/acc-declare-globals.f90 +++ b/flang/test/Lower/OpenACC/acc-declare-globals.f90 @@ -39,6 +39,14 @@ module acc_declare_copyin_test ! CHECK: acc.terminator ! CHECK: } +! CHECK-LABEL: acc.global_dtor @_QMacc_declare_copyin_testEdata1_acc_dtor { +! CHECK: %[[GLOBAL_ADDR:.*]] = fir.address_of(@_QMacc_declare_copyin_testEdata1) {acc.declare = #acc.declare} : !fir.ref> +! CHECK: %[[DEVICEPTR:.*]] = acc.getdeviceptr varPtr(%[[GLOBAL_ADDR]] : !fir.ref>) -> !fir.ref> {dataClause = #acc, name = "data1", structured = false} +! CHECK: acc.declare_exit dataOperands(%[[DEVICEPTR]] : !fir.ref>) +! CHECK: acc.delete accPtr(%[[DEVICEPTR]] : !fir.ref>) {dataClause = #acc, name = "data1", structured = false} +! CHECK: acc.terminator +! CHECK: } + module acc_declare_device_resident_test integer, parameter :: n = 5000 integer, dimension(n) :: data1 diff --git a/flang/test/Lower/OpenACC/acc-declare.f90 b/flang/test/Lower/OpenACC/acc-declare.f90 index 0066e712fbdcc..f40216e2c9fe8 100644 --- a/flang/test/Lower/OpenACC/acc-declare.f90 +++ b/flang/test/Lower/OpenACC/acc-declare.f90 @@ -82,12 +82,14 @@ subroutine acc_declare_copyin() ! CHECK: %[[ADECL:.*]]:2 = hlfir.declare %[[A]](%{{.*}}) {acc.declare = #acc.declare, uniq_name = "_QMacc_declareFacc_declare_copyinEa"} : (!fir.ref>, !fir.shape<1>) -> (!fir.ref>, !fir.ref>) ! CHECK: %[[B:.*]] = fir.alloca !fir.array<10xi32> {bindc_name = "b", uniq_name = "_QMacc_declareFacc_declare_copyinEb"} ! CHECK: %[[BDECL:.*]]:2 = hlfir.declare %[[B]](%{{.*}}) {acc.declare = #acc.declare, uniq_name = "_QMacc_declareFacc_declare_copyinEb"} : (!fir.ref>, !fir.shape<1>) -> (!fir.ref>, !fir.ref>) -! CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) extent(%{{.*}} : index) stride(%{{.*}} : index) startIdx(%{{.*}} : index) -! CHECK: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[ADECL]]#0 : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {name = "a"} -! CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) extent(%{{.*}} : index) stride(%{{.*}} : index) startIdx(%{{.*}} : index) -! CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[BDECL]]#0 : !fir.ref>) bounds(%[[BOUND]]) -> !fir.ref> {dataClause = #acc, name = "b"} +! CHECK: %[[BOUND_A:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) extent(%{{.*}} : index) stride(%{{.*}} : index) startIdx(%{{.*}} : index) +! CHECK: %[[COPYIN_A:.*]] = acc.copyin varPtr(%[[ADECL]]#0 : !fir.ref>) bounds(%[[BOUND_A]]) -> !fir.ref> {name = "a"} +! CHECK: %[[BOUND_B:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) extent(%{{.*}} : index) stride(%{{.*}} : index) startIdx(%{{.*}} : index) +! CHECK: %[[COPYIN_B:.*]] = acc.copyin varPtr(%[[BDECL]]#0 : !fir.ref>) bounds(%[[BOUND_B]]) -> !fir.ref> {dataClause = #acc, name = "b"} ! CHECK: acc.declare_enter dataOperands(%[[COPYIN_A]], %[[COPYIN_B]] : !fir.ref>, !fir.ref>) ! CHECK: %{{.*}}:2 = fir.do_loop %{{.*}} = %{{.*}} to %{{.*}} step %{{.*}} iter_args(%arg{{.*}} = %{{.*}}) -> (index, i32) +! CHECK: acc.delete accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%[[BOUND_A]]) {dataClause = #acc, name = "a"} +! CHECK: acc.delete accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%[[BOUND_B]]) {dataClause = #acc, name = "b"} subroutine acc_declare_copyout() integer :: a(100), i diff --git a/flang/test/Lower/OpenACC/acc-kernels-loop.f90 b/flang/test/Lower/OpenACC/acc-kernels-loop.f90 index e5791f0e5b392..388a14d278d6c 100644 --- a/flang/test/Lower/OpenACC/acc-kernels-loop.f90 +++ b/flang/test/Lower/OpenACC/acc-kernels-loop.f90 @@ -345,6 +345,8 @@ subroutine acc_kernels_loop ! CHECK-NEXT: }{{$}} ! CHECK: acc.terminator ! CHECK-NEXT: }{{$}} +! CHECK: acc.delete accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}) {dataClause = #acc, name = "a"} +! CHECK: acc.delete accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}) {dataClause = #acc, name = "b"} !$acc kernels loop copyout(a) copyout(zero: b) DO i = 1, n diff --git a/flang/test/Lower/OpenACC/acc-kernels.f90 b/flang/test/Lower/OpenACC/acc-kernels.f90 index ff4f1d3b54591..7282fee689cad 100644 --- a/flang/test/Lower/OpenACC/acc-kernels.f90 +++ b/flang/test/Lower/OpenACC/acc-kernels.f90 @@ -214,6 +214,9 @@ subroutine acc_kernels ! CHECK: acc.kernels dataOperands(%[[COPYIN_A]], %[[COPYIN_B]], %[[COPYIN_C]] : !fir.ref>, !fir.ref>, !fir.ref>) { ! CHECK: acc.terminator ! CHECK-NEXT: }{{$}} +! CHECK: acc.delete accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) {dataClause = #acc, name = "a"} +! CHECK: acc.delete accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) {dataClause = #acc, name = "b"} +! CHECK: acc.delete accPtr(%[[COPYIN_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) {dataClause = #acc, name = "c"} !$acc kernels copyout(a) copyout(zero: b) copyout(c) !$acc end kernels diff --git a/flang/test/Lower/OpenACC/acc-parallel-loop.f90 b/flang/test/Lower/OpenACC/acc-parallel-loop.f90 index 48ceda0710e8d..c4fc21a307b32 100644 --- a/flang/test/Lower/OpenACC/acc-parallel-loop.f90 +++ b/flang/test/Lower/OpenACC/acc-parallel-loop.f90 @@ -345,6 +345,8 @@ subroutine acc_parallel_loop ! CHECK-NEXT: }{{$}} ! CHECK: acc.yield ! CHECK-NEXT: }{{$}} +! CHECK: acc.delete accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}) {dataClause = #acc, name = "a"} +! CHECK: acc.delete accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}) {dataClause = #acc, name = "b"} !$acc parallel loop copyout(a) copyout(zero: b) DO i = 1, n diff --git a/flang/test/Lower/OpenACC/acc-parallel.f90 b/flang/test/Lower/OpenACC/acc-parallel.f90 index 5197e2b0bee09..6f6e3208d753a 100644 --- a/flang/test/Lower/OpenACC/acc-parallel.f90 +++ b/flang/test/Lower/OpenACC/acc-parallel.f90 @@ -244,6 +244,9 @@ subroutine acc_parallel ! CHECK: acc.parallel dataOperands(%[[COPYIN_A]], %[[COPYIN_B]], %[[COPYIN_C]] : !fir.ref>, !fir.ref>, !fir.ref>) { ! CHECK: acc.yield ! CHECK-NEXT: }{{$}} +! CHECK: acc.delete accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) {dataClause = #acc, name = "a"} +! CHECK: acc.delete accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) {dataClause = #acc, name = "b"} +! CHECK: acc.delete accPtr(%[[COPYIN_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) {dataClause = #acc, name = "c"} !$acc parallel copyout(a) copyout(zero: b) copyout(c) !$acc end parallel diff --git a/flang/test/Lower/OpenACC/acc-serial-loop.f90 b/flang/test/Lower/OpenACC/acc-serial-loop.f90 index fa3b3f758908c..167c05986a546 100644 --- a/flang/test/Lower/OpenACC/acc-serial-loop.f90 +++ b/flang/test/Lower/OpenACC/acc-serial-loop.f90 @@ -286,6 +286,8 @@ subroutine acc_serial_loop ! CHECK-NEXT: }{{$}} ! CHECK: acc.yield ! CHECK-NEXT: }{{$}} +! CHECK: acc.delete accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}) {dataClause = #acc, name = "a"} +! CHECK: acc.delete accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}) {dataClause = #acc, name = "b"} !$acc serial loop copyout(a) copyout(zero: b) DO i = 1, n diff --git a/flang/test/Lower/OpenACC/acc-serial.f90 b/flang/test/Lower/OpenACC/acc-serial.f90 index 284f61976a46d..6f79e18c71442 100644 --- a/flang/test/Lower/OpenACC/acc-serial.f90 +++ b/flang/test/Lower/OpenACC/acc-serial.f90 @@ -188,6 +188,9 @@ subroutine acc_serial ! CHECK: acc.serial dataOperands(%[[COPYIN_A]], %[[COPYIN_B]], %[[COPYIN_C]] : !fir.ref>, !fir.ref>, !fir.ref>) { ! CHECK: acc.yield ! CHECK-NEXT: }{{$}} +! CHECK: acc.delete accPtr(%[[COPYIN_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) {dataClause = #acc, name = "a"} +! CHECK: acc.delete accPtr(%[[COPYIN_B]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) {dataClause = #acc, name = "b"} +! CHECK: acc.delete accPtr(%[[COPYIN_C]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) {dataClause = #acc, name = "c"} !$acc serial copyout(a) copyout(zero: b) copyout(c) !$acc end serial