[PATCH] D100224: [flang][OpenMP] Add semantic check for occurrence of variables other than loop iteration variable in a `linear` clause associated with a `distribute` construct.

Kiran Chandramohan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 12 00:42:14 PDT 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:351
+
+      for (const parser::DoConstruct *loop{&*loopConstruct}; loop;) {
+        if (loop->IsDoNormal()) {
----------------
You have to check whether the nested loops are associated with the distribute simd construct. If they are associated then they should be picked up, otherwise they should not be. Association here is probably only through the collapse clause. 

For e.g: The following test should provide an error.
```
  !$omp distribute simd linear(i,j) 
  do i = 1, N
    do j = 1, N
       a = 3.14
    enddo
  enddo
  !$omp end distribute simd
```

The following test should not.
```
 !$omp distribute simd collapse(2) linear(i,j) 
  do i = 1, N
    do j = 1, N
       a = 3.14
    enddo
  enddo
  !$omp end distribute simd
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100224



More information about the llvm-commits mailing list