[OPENMP50]Codegen for inscan reductions in worksharing directives.
authorAlexey Bataev <a.bataev@hotmail.com>
Mon, 4 May 2020 20:19:31 +0000 (16:19 -0400)
committerAlexey Bataev <a.bataev@hotmail.com>
Thu, 4 Jun 2020 20:29:33 +0000 (16:29 -0400)
commitbd1c03d7b7c8bdd80b534cf2fa956c36a2f8249f
tree013c9d852d25ca17589a48bdd2c56468479ec811
parenta07c08f74fafcbf196cda4b20f0761538fca3dbe
[OPENMP50]Codegen for inscan reductions in worksharing directives.

Summary:
Implemented codegen for reduction clauses with inscan modifiers in
worksharing constructs.

Emits the code for the directive with inscan reductions.
The code is the following:
```
size num_iters = <num_iters>;
<type> buffer[num_iters];
for (i: 0..<num_iters>) {
  <input phase>;
  buffer[i] = red;
}
for (int k = 0; k != ceil(log2(num_iters)); ++k)
for (size cnt = last_iter; cnt >= pow(2, k); --k)
  buffer[i] op= buffer[i-pow(2,k)];
for (0..<num_iters>) {
  red = InclusiveScan ? buffer[i] : buffer[i-1];
  <scan phase>;
}
```

Reviewers: jdoerfert

Subscribers: yaxunl, guansong, arphaman, cfe-commits, caomhin

Tags: #clang

Differential Revision: https://reviews.llvm.org/D79948
13 files changed:
clang/include/clang/AST/OpenMPClause.h
clang/include/clang/AST/RecursiveASTVisitor.h
clang/lib/AST/OpenMPClause.cpp
clang/lib/AST/StmtProfile.cpp
clang/lib/CodeGen/CGStmt.cpp
clang/lib/CodeGen/CGStmtOpenMP.cpp
clang/lib/CodeGen/CodeGenFunction.h
clang/lib/Sema/SemaOpenMP.cpp
clang/lib/Serialization/ASTReader.cpp
clang/lib/Serialization/ASTWriter.cpp
clang/test/OpenMP/for_scan_codegen.cpp [new file with mode: 0644]
clang/test/OpenMP/scan_messages.cpp
clang/tools/libclang/CIndex.cpp