[PATCH] D108904: [flang][OpenMP] Added semantic checks for sections (associated section(s) should be structured block(s)) and simd constructs (associated loop(s) should be structured block(s))

Kiran Chandramohan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 28 03:51:56 PDT 2021


kiranchandramohan added inline comments.


================
Comment at: flang/lib/Semantics/check-directive-structure.h:160
+  // encountering an OpenMP/OpenACC directive
+  ConstructStack privateConstructStack;
   SemanticsContext &context_;
----------------
NimishMishra wrote:
> kiranchandramohan wrote:
> > Looking at this again, do we need a construct stack? Can we just maintain a DoConstruct counter (which increments on entering (or Pre) a Do and decrements on leaving (or Post) a Do)? And if the DoConstruct counter value is greater than 0 then we are inside a DoConstruct, else outside.
> Yes it can be. However, note that this //class NoBranchingEnforce// is used by a //parser::Walk// within //CheckNoBranching// function whose aim is to check non-essential branching within OpenMP/OpenACC constructs.
> 
> Do you think, in foresight, that this private stack approach would be better than the counter approach? Just in case there may come up a use for some other construct as we expand our OpenMP/OpenACC support. 
> 
> Similar thought I had for the introduced //CheckForRequiredConstruct//. As we expand, it could serve as the point of call from various other functions/places aiding them to make a decision on when to throw the illegal branching error.
In the past, there have been instances where we have replaced with a more general data-structure. If you can point out a particular case where this will be required then let us keep the construct stack and add a comment saying this will be useful when we implement that case. Otherwise, let us replace it with a counter.

Can you quickly glance through the standard and have a quick check whether there are such checks required? From the top of my head, I don't see anything but I could have missed something.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108904



More information about the llvm-commits mailing list