[flang-commits] [flang] [flang][acc] Implement cache directive lowering (PR #174897)

via flang-commits flang-commits at lists.llvm.org
Fri Jan 9 09:52:54 PST 2026


================
@@ -3506,7 +3506,14 @@ class FirConverter : public Fortran::lower::AbstractConverter {
 
   void genFIR(const Fortran::parser::OpenACCConstruct &acc) {
     mlir::OpBuilder::InsertPoint insertPt = builder->saveInsertionPoint();
-    localSymbols.pushScope();
+
+    // Cache constructs should not push/pop a scope because they need to update
+    // the symbol map for subsequent statements in the same loop body.
----------------
khaki3 wrote:

I believe it's better to have a semantic check that raises an explicit error for now. As both of you suggest, the cache is meant to be effective under loop-level parallelism. If it becomes conditional, that requires a dynamic cache, which is not explicitly prohibited by the spec, but it's likely not meant that way.

https://github.com/llvm/llvm-project/pull/174897


More information about the flang-commits mailing list