[all-commits] [llvm/llvm-project] a58da1: [OPENMP50]Codegen for lastprivate conditional list...

Alexey Bataev via All-commits all-commits at lists.llvm.org
Thu Jan 2 13:45:59 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: a58da1a2ff039dd3bb4c43db3919995cf4a74cc7
      https://github.com/llvm/llvm-project/commit/a58da1a2ff039dd3bb4c43db3919995cf4a74cc7
  Author: Alexey Bataev <a.bataev at hotmail.com>
  Date:   2020-01-02 (Thu, 02 Jan 2020)

  Changed paths:
    M clang/lib/CodeGen/CGExpr.cpp
    M clang/lib/CodeGen/CGExprComplex.cpp
    M clang/lib/CodeGen/CGExprScalar.cpp
    M clang/lib/CodeGen/CGOpenMPRuntime.cpp
    M clang/lib/CodeGen/CGOpenMPRuntime.h
    M clang/lib/CodeGen/CGStmtOpenMP.cpp
    M clang/test/OpenMP/for_lastprivate_codegen.cpp
    M clang/test/OpenMP/simd_codegen.cpp

  Log Message:
  -----------
  [OPENMP50]Codegen for lastprivate conditional list items.

Added codegen support for lastprivate conditional. According to the
standard, if  when the conditional modifier appears on the clause, if an
assignment to a list item is encountered in the construct then the
original list item is assigned the value that is assigned to the new
list item in the sequentially last iteration or lexically last section
in which such an assignment is encountered.
We look for the assignment operations and check if the left side
references lastprivate conditional variable. Then the next code is
emitted:
if (last_iv_a <= iv) {
  last_iv_a = iv;
  last_a = lp_a;
}

At the end the implicit barrier is generated to wait for the end of all
threads and then in the check for the last iteration the private copy is
assigned the last value.

if (last_iter) {
  lp_a = last_a; // <--- new code
  a = lp_a;      // <--- store of private value to the original  variable.
}




More information about the All-commits mailing list