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

via flang-commits flang-commits at lists.llvm.org
Fri Jan 9 12:08:40 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 updated the visitor to support the scope with Fortran constructs. I was reluctant to have an OpenACC-specific process in Fortran statement traversal. But the `return` handling already uses `isInOpenACCLoop`.

Adding a semantics check to detect the parent `IF` required an `IF` handler in check-acc-structure.cpp, which seemed too much for the moment.

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


More information about the flang-commits mailing list