[flang-commits] [flang] 6c73f5e - [flang][acc] Add TODO for cache directive lowering (#170608)
via flang-commits
flang-commits at lists.llvm.org
Wed Dec 3 22:37:32 PST 2025
Author: Zhen Wang
Date: 2025-12-04T06:37:28Z
New Revision: 6c73f5e7170bc4b3111f935285ced4033a098644
URL: https://github.com/llvm/llvm-project/commit/6c73f5e7170bc4b3111f935285ced4033a098644
DIFF: https://github.com/llvm/llvm-project/commit/6c73f5e7170bc4b3111f935285ced4033a098644.diff
LOG: [flang][acc] Add TODO for cache directive lowering (#170608)
The OpenACC cache directive is not yet fully implemented. Add a TODO to
emit a clear "not yet implemented" error during lowering.
Added:
flang/test/Lower/OpenACC/Todo/acc-cache.f90
Modified:
flang/lib/Lower/OpenACC.cpp
flang/test/Lower/OpenACC/acc-loop.f90
Removed:
################################################################################
diff --git a/flang/lib/Lower/OpenACC.cpp b/flang/lib/Lower/OpenACC.cpp
index 69c3300ba4390..5a548f4fcf435 100644
--- a/flang/lib/Lower/OpenACC.cpp
+++ b/flang/lib/Lower/OpenACC.cpp
@@ -4787,6 +4787,8 @@ genACC(Fortran::lower::AbstractConverter &converter,
Fortran::semantics::SemanticsContext &semanticsContext,
const Fortran::parser::OpenACCCacheConstruct &cacheConstruct) {
fir::FirOpBuilder &builder = converter.getFirOpBuilder();
+ mlir::Location loc = converter.genLocation(cacheConstruct.source);
+ TODO(loc, "OpenACC cache directive");
auto loopOp = builder.getRegion().getParentOfType<mlir::acc::LoopOp>();
auto crtPos = builder.saveInsertionPoint();
if (loopOp) {
diff --git a/flang/test/Lower/OpenACC/Todo/acc-cache.f90 b/flang/test/Lower/OpenACC/Todo/acc-cache.f90
new file mode 100644
index 0000000000000..8b81e876ed2c9
--- /dev/null
+++ b/flang/test/Lower/OpenACC/Todo/acc-cache.f90
@@ -0,0 +1,15 @@
+! RUN: %not_todo_cmd bbc -fopenacc -emit-hlfir %s -o - 2>&1 | FileCheck %s
+
+! CHECK: not yet implemented: OpenACC cache directive
+
+subroutine test_cache()
+ integer, parameter :: n = 10
+ real, dimension(n) :: a, b
+ integer :: i
+
+ !$acc loop
+ do i = 1, n
+ !$acc cache(b)
+ a(i) = b(i)
+ end do
+end subroutine
diff --git a/flang/test/Lower/OpenACC/acc-loop.f90 b/flang/test/Lower/OpenACC/acc-loop.f90
index 6adf06ad9cd53..ed87cf76038b5 100644
--- a/flang/test/Lower/OpenACC/acc-loop.f90
+++ b/flang/test/Lower/OpenACC/acc-loop.f90
@@ -359,15 +359,6 @@ program acc_loop
! CHECK: acc.yield
! CHECK-NEXT: } attributes {inclusiveUpperbound = array<i1: true>, independent = [#acc.device_type<none>]}
- !$acc loop
- DO i = 1, n
- !$acc cache(b)
- a(i) = b(i)
- END DO
-
-! CHECK: %[[CACHE:.*]] = acc.cache varPtr(%{{.*}} : !fir.ref<!fir.array<10xf32>>) -> !fir.ref<!fir.array<10xf32>> {name = "b"}
-! CHECK: acc.loop {{.*}} cache(%[[CACHE]] : !fir.ref<!fir.array<10xf32>>)
-
!$acc loop
do 100 i=0, n
100 continue
More information about the flang-commits
mailing list