[flang-commits] [flang] [flang][OpenMP] Fix declare target after #200446 (PR #203364)

Eugene Epshteyn via flang-commits flang-commits at lists.llvm.org
Fri Jun 12 10:53:24 PDT 2026


================
@@ -3076,24 +3076,28 @@ void OmpAttributeVisitor::PropagateOmpFlagToEquivalenceSet(
 
 void OmpAttributeVisitor::ResolveOmpCommonBlock(
     const parser::Name &name, Symbol::Flag ompFlag) {
+  bool cbResolved{false};
   if (name.symbol) {
     if (auto *details{name.symbol->detailsIf<CommonBlockDetails>()}) {
       if (!details->objects().empty()) {
         // Common block already resolved
-        return;
+        cbResolved = true;
       }
     }
   }
 
-  if (auto *symbol{ResolveOmpCommonBlockName(&name)}) {
+  parser::Name cbName{name};
+  Symbol *originalCB{ResolveOmpCommonBlockName(&cbName)};
----------------
eugeneepshteyn wrote:

Basically, `ResolveOmpCommonBlockName()` walks common blocks and there could be many of them in the legacy code. If we don't have to do those walks for already resolved common blocks, that would be benefit to the compile time.

https://github.com/llvm/llvm-project/pull/203364


More information about the flang-commits mailing list