diff --git a/flang/lib/Lower/ConvertCall.cpp b/flang/lib/Lower/ConvertCall.cpp index a5a954a5ccea5..fb72040f9ea14 100644 --- a/flang/lib/Lower/ConvertCall.cpp +++ b/flang/lib/Lower/ConvertCall.cpp @@ -571,6 +571,8 @@ Fortran::lower::genCallOpAndResult( !cuf::isCUDADeviceContext(builder.getRegion())) { for (auto [oper, arg] : llvm::zip(operands, caller.getPassedArguments())) { + if (arg.testTKR(Fortran::common::IgnoreTKR::Contiguous)) + continue; if (auto boxTy = mlir::dyn_cast(oper.getType())) { const Fortran::semantics::Symbol *sym = caller.getDummySymbol(arg); if (sym && Fortran::evaluate::IsCUDADeviceSymbol(*sym)) diff --git a/flang/test/Lower/CUDA/cuda-runtime-check.cuf b/flang/test/Lower/CUDA/cuda-runtime-check.cuf index 1aa95ec0ff405..02bb593db7305 100644 --- a/flang/test/Lower/CUDA/cuda-runtime-check.cuf +++ b/flang/test/Lower/CUDA/cuda-runtime-check.cuf @@ -16,6 +16,10 @@ contains call foo(a(1:10,1:10:2)) end subroutine +! CHECK-LABEL: func.func @_QMsection_testPtest_host() +! CHECK: fir.call @_FortranACUFDescriptorCheckSection +! CHECK: fir.call @_QMsection_testPfoo + attributes(device) subroutine zoo(a) real, device, dimension(:,:) :: a end subroutine @@ -25,12 +29,23 @@ contains allocate(a(10,10)) call zoo(a(1:10,1:10:2)) end subroutine -end module - -! CHECK-LABEL: func.func @_QMsection_testPtest_host() -! CHECK: fir.call @_FortranACUFDescriptorCheckSection -! CHECK: fir.call @_QMsection_testPfoo ! CHECK-LABEL: func.func @_QMsection_testPtest_device() ! CHECK-NOT: fir.call @_FortranACUFDescriptorCheckSection ! CHECK: fir.call @_QMsection_testPzoo + + subroutine ignore(a) + real, device, dimension(:,:) :: a + !dir$ ignore_tkr(c) a + end subroutine + + subroutine test_host2() + real, device, allocatable, dimension(:,:) :: a + allocate(a(10,10)) + call ignore(a(1:10,1:10:2)) + end subroutine + +! CHECK-LABEL: func.func @_QMsection_testPtest_host2() +! CHECK-NOT: fir.call @_FortranACUFDescriptorCheckSection +! CHECK: fir.call @_QMsection_testPignore +end module