[PATCH] D99970: [flang][OpenMP] Add functionality to check "close nesting" of regions, which can be used for Semantic checks.

Kiran Chandramohan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 6 13:59:35 PDT 2021


kiranchandramohan added inline comments.


================
Comment at: flang/lib/Semantics/check-omp-structure.cpp:130
 
+bool OmpStructureChecker::IsCloselyNested(const OmpDirectiveSet &set) {
+  // Definition of close nesting:
----------------
arnamoy10 wrote:
> kiranchandramohan wrote:
> > I was thinking you will be doing the following. Is there an issue with this approach?
> > 
> > 1) curIndex = index of top of stack
> > 2) curDir = Directive at curIndex
> > 3) If (curDir is a violating nesting) return true
> > 4) if (curDir is parallel) return false
> > 5) if curIndex == -1 return false
> > 6) curIndex = curIndex - 1
> > 7) goto step 2
> I do not think I understand Step 3: `If (curDir is a violating nesting) return true`
> 
> Let's say we are doing the violation check that `barrier` is not allowed inside a `task`
> ```
> $!omp task
>   $!omp target
>     $!omp barrier --> top of stack
> ```
> 
> So `curDir` is `barrier`.  Could you tell me how step 3 would work as per your algorithm?
> 
In the algorithm I was suggesting the assumption I made is that the top of stack is !$omp target and not !$omp barrier.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99970/new/

https://reviews.llvm.org/D99970



More information about the llvm-commits mailing list