[flang-commits] [flang] [flang][OpenMP] Fix standalone SIMD directive post-loop variable value (PR #196731)
Leandro Lupori via flang-commits
flang-commits at lists.llvm.org
Fri Aug 14 10:55:43 PDT 2026
================
@@ -2251,9 +2256,18 @@ void OmpAttributeVisitor::PrivatizeAssociatedLoopIndex(
continue;
}
if (auto *symbol{ResolveOmp(*iv, ivDSA, scope)}) {
- SetSymbolDSA(*symbol, {Symbol::Flag::OmpPreDetermined, ivDSA});
+ Symbol::Flags ivFlags{Symbol::Flag::OmpPreDetermined, ivDSA};
+ // For a standalone SIMD loop variable set lastprivate so the original
+ // variable is correctly set to the last value of the loop variable as
+ // per the OpenMP spec
+ if (ivDSA == Symbol::Flag::OmpLinear &&
+ llvm::omp::topSimdSet.test(GetContext().directive))
+ ivFlags.set(Symbol::Flag::OmpLastPrivate);
+ SetSymbolDSA(*symbol, ivFlags);
----------------
luporl wrote:
Is this part still needed after #183800?
https://github.com/llvm/llvm-project/pull/196731
More information about the flang-commits
mailing list