[OPENMP50]Codegen for scan directive in simd loops.
authorAlexey Bataev <a.bataev@hotmail.com>
Thu, 11 Jun 2020 15:28:59 +0000 (11:28 -0400)
committerAlexey Bataev <a.bataev@hotmail.com>
Thu, 11 Jun 2020 18:48:43 +0000 (14:48 -0400)
commit43101d10dbd58d48df732f974e078fd82376039e
treec9f8a3c7a18f8663bb61583f59b858825875af57
parent70ad73b6b76838bd7c72123922102b175e5d478a
[OPENMP50]Codegen for scan directive in simd loops.

Added codegen for scan directives 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]