[PATCH] D92732: [Flang][OpenMP 4.5] Add semantic check for OpenMP Do Loop Constructs

Kiran Chandramohan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 22 17:06:48 PST 2021


kiranchandramohan requested changes to this revision.
kiranchandramohan added inline comments.
This revision now requires changes to proceed.


================
Comment at: flang/lib/Semantics/check-omp-structure.cpp:213
+        for (auto iit{blk.begin()}; iit != blk.end(); ++iit) {
+          if (const auto *ifstmt{parser::Unwrap<parser::IfStmt>(*iit)}) {
+            const auto &actionstmt{std::get<1>(ifstmt->t)};
----------------
yhegde wrote:
> kiranchandramohan wrote:
> > Is there an assumption here that if statement will be present when a cycle statement exists? Does the standard say that?
> Cycles with out  ifstmts are also handled. 
I think it might not work with else if, nested if etc.

Anyway, my point was that cycle statements can appear inside other fortran constructs, for e.g in a case statement like in the example below. So this portion of the code has to be generic and not limited to if statements.
```
program test
  integer i, j, k
  !$omp do collapse(3)
  foo: do i = 0, 10
    bar: do j = 0, 10
           do k = 0, 10
             select case (k)
               case (1)
                 cycle foo
               case (2)
                 cycle bar
               case default
                 cycle
             end select
           end do
         end do bar
  end do foo
  !$omp end do
end program
```


================
Comment at: flang/lib/Semantics/check-omp-structure.h:229
+  std::vector<Symbol *> threadPrivateSymbols;
+  const parser::OmpClause::Ordered *ordClause{nullptr};
 };
----------------
Are you resetting this to null anywhere? Stale values might cause issues.

Instead of this method can you travel up the stack, find the do construct if any and check its clauses for the ordered clause?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92732



More information about the llvm-commits mailing list