[flang-commits] [flang] e5ad7f7 - [flang][OpenMP] Remove ompFlagsRequireMark from symbol resolution (#198591)
via flang-commits
flang-commits at lists.llvm.org
Wed May 27 08:02:24 PDT 2026
Author: Krzysztof Parzyszek
Date: 2026-05-27T10:02:17-05:00
New Revision: e5ad7f7e700ea839896b5ece924ef13acf573833
URL: https://github.com/llvm/llvm-project/commit/e5ad7f7e700ea839896b5ece924ef13acf573833
DIFF: https://github.com/llvm/llvm-project/commit/e5ad7f7e700ea839896b5ece924ef13acf573833.diff
LOG: [flang][OpenMP] Remove ompFlagsRequireMark from symbol resolution (#198591)
The `ompFlagsRequireMark` set was there to make sure that we put the
flags from it on symbols even when no new symbols needed to be created.
Instead of doing that, we can just put the flag on the symbol every
time. There is no harm in having these flags, it's just extra
information.
Added:
Modified:
flang/lib/Semantics/resolve-directives.cpp
flang/test/Semantics/OpenMP/declare-simd-uniform.f90
Removed:
################################################################################
diff --git a/flang/lib/Semantics/resolve-directives.cpp b/flang/lib/Semantics/resolve-directives.cpp
index af27d110d3350..af73c53715596 100644
--- a/flang/lib/Semantics/resolve-directives.cpp
+++ b/flang/lib/Semantics/resolve-directives.cpp
@@ -171,7 +171,6 @@ template <typename T> class DirectiveAttributeVisitor {
Symbol *DeclareNewAccessEntity(const Symbol &, Symbol::Flag, Scope &);
Symbol *DeclareAccessEntity(const parser::Name &, Symbol::Flag, Scope &);
Symbol *DeclareAccessEntity(Symbol &, Symbol::Flag, Scope &);
- Symbol *DeclareOrMarkOtherAccessEntity(const parser::Name &, Symbol::Flag);
UnorderedSymbolSet dataSharingAttributeObjects_; // on one directive
SemanticsContext &context_;
@@ -1027,11 +1026,6 @@ class OmpAttributeVisitor : DirectiveAttributeVisitor<llvm::omp::Directive> {
Symbol::Flag::OmpUseDeviceAddr, Symbol::Flag::OmpIsDevicePtr,
Symbol::Flag::OmpHasDeviceAddr, Symbol::Flag::OmpUniform};
- Symbol::Flags ompFlagsRequireMark{Symbol::Flag::OmpThreadprivate,
- Symbol::Flag::OmpDeclareTarget, Symbol::Flag::OmpExclusiveScan,
- Symbol::Flag::OmpInclusiveScan, Symbol::Flag::OmpInScanReduction,
- Symbol::Flag::OmpGroupPrivate};
-
Symbol::Flags dataCopyingAttributeFlags{
Symbol::Flag::OmpCopyIn, Symbol::Flag::OmpCopyPrivate};
@@ -3009,9 +3003,7 @@ void OmpAttributeVisitor::PropagateOmpFlagToEquivalenceSet(
// Set the OpenMP flag on the equivalenced symbol
if (Symbol * resolvedSymbol{ResolveOmp(eqSymbol, ompFlag, currScope())}) {
// Also add to the context if needed
- if (ompFlagsRequireMark.test(ompFlag)) {
- AddToContextObjectWithExplicitDSA(*resolvedSymbol, ompFlag);
- }
+ AddToContextObjectWithExplicitDSA(*resolvedSymbol, ompFlag);
}
}
}
@@ -3102,9 +3094,7 @@ Symbol *OmpAttributeVisitor::DeclareOrMarkOtherAccessEntity(
Symbol *OmpAttributeVisitor::DeclareOrMarkOtherAccessEntity(
Symbol &object, Symbol::Flag ompFlag) {
- if (ompFlagsRequireMark.test(ompFlag)) {
- object.set(ompFlag);
- }
+ object.set(ompFlag);
return &object;
}
diff --git a/flang/test/Semantics/OpenMP/declare-simd-uniform.f90 b/flang/test/Semantics/OpenMP/declare-simd-uniform.f90
index f729773cdd2e2..1ca18a98976e3 100644
--- a/flang/test/Semantics/OpenMP/declare-simd-uniform.f90
+++ b/flang/test/Semantics/OpenMP/declare-simd-uniform.f90
@@ -14,7 +14,7 @@ function add2(a,b,i,fact,alc) result(c)
! CHECK-LABEL: Subprogram scope: add2 size=48 alignment=8 sourceRange=189 bytes
! CHECK-NEXT: a (OmpUniform): ObjectEntity dummy type: REAL(8) shape: 1_8:*
-! CHECK-NEXT: add2 (Function): HostAssoc
+! CHECK-NEXT: add2 (Function, OmpDeclareSimd): HostAssoc
! CHECK-NEXT: alc, POINTER size=24 offset=8: ObjectEntity dummy type: INTEGER(4)
! CHECK-NEXT: b (OmpUniform): ObjectEntity dummy type: REAL(8) shape: 1_8:*
! CHECK-NEXT: c size=8 offset=40: ObjectEntity funcResult type: REAL(8)
More information about the flang-commits
mailing list