-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[flang][OpenMP] Consider previous DSA for static duration variables #143601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[flang][OpenMP] Consider previous DSA for static duration variables #143601
Conversation
Symbols that have a pre-existing DSA set in the enclosing context should not be made shared based on them being static duration variables. Suggested-by: Leandro Lupori <[email protected]> Signed-off-by: Kajetan Puchalski <[email protected]>
@llvm/pr-subscribers-flang-semantics @llvm/pr-subscribers-flang-openmp Author: Kajetan Puchalski (mrkajetanp) ChangesSymbols that have a pre-existing DSA set in the enclosing context should not be made shared based on them being static duration variables. Suggested-by: Leandro Lupori <[email protected]> Full diff: https://github.com/llvm/llvm-project/pull/143601.diff 1 Files Affected:
diff --git a/flang/lib/Semantics/resolve-directives.cpp b/flang/lib/Semantics/resolve-directives.cpp
index 65823adcef19d..93bf510fbc3c7 100644
--- a/flang/lib/Semantics/resolve-directives.cpp
+++ b/flang/lib/Semantics/resolve-directives.cpp
@@ -2382,7 +2382,9 @@ void OmpAttributeVisitor::CreateImplicitSymbols(const Symbol *symbol) {
dsa = prevDSA;
} else if (taskGenDir) {
// TODO 5) dummy arg in orphaned taskgen construct -> firstprivate
- if (prevDSA.test(Symbol::Flag::OmpShared) || isStaticStorageDuration) {
+ if (prevDSA.test(Symbol::Flag::OmpShared) ||
+ (isStaticStorageDuration &&
+ (prevDSA & dataSharingAttributeFlags).none())) {
// 6) shared in enclosing context -> shared
dsa = {Symbol::Flag::OmpShared};
makeSymbol(dsa);
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please could you add a lit test for this case to guard against it regressing again in the future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
…lvm#143601) Symbols that have a pre-existing DSA set in the enclosing context should not be made shared based on them being static duration variables. Suggested-by: Leandro Lupori <[email protected]> --------- Signed-off-by: Kajetan Puchalski <[email protected]>
…lvm#143601) Symbols that have a pre-existing DSA set in the enclosing context should not be made shared based on them being static duration variables. Suggested-by: Leandro Lupori <[email protected]> --------- Signed-off-by: Kajetan Puchalski <[email protected]>
Symbols that have a pre-existing DSA set in the enclosing context should not be made shared based on them being static duration variables.
Suggested-by: Leandro Lupori [email protected]