[PATCH] D78232: [OPENMP50]Codegen for scan directive in simd loops.

Alexey Bataev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 15 12:37:07 PDT 2020


ABataev created this revision.
ABataev added a reviewer: jdoerfert.
Herald added subscribers: arphaman, guansong, yaxunl, jholewinski.
Herald added a project: clang.

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>
  }


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78232

Files:
  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/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGOpenMPRuntime.h
  clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
  clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.h
  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/scan_codegen.cpp
  clang/test/OpenMP/scan_messages.cpp
  clang/tools/libclang/CIndex.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78232.257802.patch
Type: text/x-patch
Size: 84395 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200415/c5704a49/attachment-0001.bin>


More information about the cfe-commits mailing list