[OPENMP50]Codegen for scan directive in simd loops.
authorAlexey Bataev <a.bataev@hotmail.com>
Fri, 5 Jun 2020 19:17:14 +0000 (15:17 -0400)
committerAlexey Bataev <a.bataev@hotmail.com>
Thu, 11 Jun 2020 13:01:23 +0000 (09:01 -0400)
commitfb80e67f10eea7177b0ff9c618c8231363b6f2fc
tree21ab281dc104d46e209c464f5d37df98e2f04a1a
parent948b206fc236502caa20e51cf39b9d4d0fda00b6
[OPENMP50]Codegen for scan directive in simd loops.

Added codegen for scandirectives in simd loop. The codegen transforms
original code:

```
int x = 0;
 #pragma omp simd reduction(inscan, +: x)
for (..) {
  <first part>
  #pragma omp scan inclusive(x)
  <second part>
}
```
into
```
int x = 0;
for (..) {
  int x_priv = 0;
  <first part>
  x = x_priv + x;
  x_priv = x;
  <second part>
}
```
and
```
int x = 0;
 #pragma omp simd reduction(inscan, +: x)
for (..) {
  <first part>
  #pragma omp scan exclusive(x)
  <second part>
}
```
into
```
int x = 0;
for (..) {
  int x_priv = 0;
  <second part>
  int temp = x;
  x = x_priv + x;
  x_priv = temp;
  <first part>
}
```

Differential revision: https://reviews.llvm.org/D78232
clang/lib/CodeGen/CGStmtOpenMP.cpp
clang/lib/Sema/SemaOpenMP.cpp
clang/test/OpenMP/scan_codegen.cpp [new file with mode: 0644]