[PATCH] D110502: [Flang][openmp] Add semantic checks for OpenMP critical construct name resolution

Nimish Mishra via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 26 08:12:40 PDT 2021


NimishMishra created this revision.
NimishMishra added projects: LLVM, OpenMP, Flang.
Herald added subscribers: jdoerfert, guansong, yaxunl.
Herald added a reviewer: sscalpone.
NimishMishra requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: llvm-commits, sstefan1.

As reported in https://bugs.llvm.org/show_bug.cgi?id=48145, name resolution for omp critical construct was failing. This patch adds functionality to help that name resolution as well as implementation to catch name mismatches.

- **Changes to check-omp-structure.cpp**

In //llvm-project/flang/lib/Semantics/check-omp-structure.cpp//, under  //void OmpStructureChecker::Enter(const parser::OpenMPCriticalConstruct &x)//, logic is added to handle the different forms of name mismatches and report appropriate error. The following semantic restrictions are therefore handled here:

1. If a name is specified on a critical directive, the same name must also be specified on the end critical directive
2. If no name appears on the critical directive, no name can appear on the end critical directive
3. If a name appears on either the start critical directive or the end critical directive

The only allowed combinations are: (1) both start and end directives have same name, (2) both start and end directives have NO name altogether

- **Changes to resolve-directives.cpp**

In //llvm-project/flang/lib/Semantics/resolve-directives.cpp//, two //Pre// functions are added for //OmpCriticalDirective// and //OmpEndCriticalDirective// that invoke the services of //ResolveOmpName// to give new symbols to the names. This aids in removing the undesirable behavior noted in https://bugs.llvm.org/show_bug.cgi?id=48145


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110502

Files:
  flang/lib/Semantics/check-omp-structure.cpp
  flang/lib/Semantics/resolve-directives.cpp
  flang/test/Semantics/omp-sync-critical01.f90
  flang/test/Semantics/omp-sync-critical02.f90

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110502.375112.patch
Type: text/x-patch
Size: 6006 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210926/b44e8562/attachment.bin>


More information about the llvm-commits mailing list