[llvm-branch-commits] [flang] [flang][OpenMP] Support tasks' implicit firstprivate DSA (PR #85989)
Leandro Lupori via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Apr 24 12:24:46 PDT 2024
================
@@ -2012,34 +2012,87 @@ void OmpAttributeVisitor::Post(const parser::Name &name) {
}
}
}
- std::vector<Symbol *> defaultDSASymbols;
+
+ // Implicitly determined DSAs
+ // OMP 5.2 5.1.1 - Variables Referenced in a Construct
+ Symbol *lastDeclSymbol = nullptr;
+ std::optional<Symbol::Flag> prevDSA;
for (int dirDepth{0}; dirDepth < (int)dirContext_.size(); ++dirDepth) {
DirContext &dirContext = dirContext_[dirDepth];
- bool hasDataSharingAttr{false};
+ std::optional<Symbol::Flag> dsa;
+
for (auto symMap : dirContext.objectWithDSA) {
// if the `symbol` already has a data-sharing attribute
if (symMap.first->name() == name.symbol->name()) {
- hasDataSharingAttr = true;
+ dsa = symMap.second;
break;
}
}
- if (hasDataSharingAttr) {
- if (defaultDSASymbols.size())
- symbol = &MakeAssocSymbol(symbol->name(), *defaultDSASymbols.back(),
+
+ // When handling each implicit rule, either a new private symbol is
+ // declared or the last declared symbol is used.
+ // In the latter case, it's necessary to insert a new symbol in the scope
+ // being processed, associated with the last declared symbol, to avoid
+ // "inheriting" the enclosing context's symbol and its flags.
----------------
luporl wrote:
I have expanded the explanation of why a new symbol is needed when inheriting the enclosing context's symbol.
Please check if it is clear now.
https://github.com/llvm/llvm-project/pull/85989
More information about the llvm-branch-commits
mailing list