[flang-commits] [flang] [flang][acc] Implement cache directive lowering (PR #174897)
via flang-commits
flang-commits at lists.llvm.org
Fri Jan 9 09:14:31 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:
Nice catch. They indeed cause an ICE. For the first case, we might be able to force the cache directive to be placed on the top of the loop as the spec suggests. But the second case is tricky (while `b(i,m,:)` should be `b(i,m,1:)` or so). It's already on the top.
I believe adding the cache operation inside the loop is necessary to hold iterators without a hack. Let me check more about scoping.
https://github.com/llvm/llvm-project/pull/174897
More information about the flang-commits
mailing list