Adding support for target in_reduction
authorRitanya B Bharadwaj <ritanya-b.bharadwaj@hpe.com>
Mon, 27 Jun 2022 15:35:30 +0000 (10:35 -0500)
committerChi Chun Chen <chichun.chen@hpe.com>
Mon, 27 Jun 2022 15:36:46 +0000 (10:36 -0500)
commit8322fe200d60919bcf19700138f04f9fdc909360
tree734a8ae954c792f14bf95f803ee17f6e8cb03cfe
parentb4f2d7cde54c301f591a8e2a16135bb113c5e7ed
Adding support for target in_reduction

Implementing target in_reduction by wrapping target task with host task with in_reduction and if clause. This is in compliance with OpenMP 5.0 section: 2.19.5.6.
So, this

```
  for (int i=0; i<N; i++) {
    res = res+i
  }
```

will become

```

   #pragma omp task in_reduction(+:res) if(0)
   #pragma omp target map(res)
   for (int i=0; i<N; i++) {
     res = res+i
   }
```

Reviewed By: ABataev

Differential Revision: https://reviews.llvm.org/D125669
clang/lib/CodeGen/CGOpenMPRuntime.cpp
clang/lib/CodeGen/CGStmtOpenMP.cpp
clang/lib/CodeGen/CodeGenFunction.h
clang/lib/Sema/SemaOpenMP.cpp
clang/test/OpenMP/target_in_reduction_codegen.cpp [new file with mode: 0644]
llvm/include/llvm/Frontend/OpenMP/OMP.td