[all-commits] [llvm/llvm-project] 240dd9: [OpenMPIRBuilder] forward arguments as pointers to...

ftynse via All-commits all-commits at lists.llvm.org
Wed Dec 2 06:00:02 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 240dd92432ebbfbf24ef85779f2cdf93e6ddf605
      https://github.com/llvm/llvm-project/commit/240dd92432ebbfbf24ef85779f2cdf93e6ddf605
  Author: Alex Zinenko <zinenko at google.com>
  Date:   2020-12-02 (Wed, 02 Dec 2020)

  Changed paths:
    M clang/lib/CodeGen/CGStmtOpenMP.cpp
    M clang/test/OpenMP/parallel_codegen.cpp
    M llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
    M llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
    M llvm/lib/Transforms/IPO/OpenMPOpt.cpp
    M llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
    M mlir/lib/Target/LLVMIR/ModuleTranslation.cpp

  Log Message:
  -----------
  [OpenMPIRBuilder] forward arguments as pointers to outlined function

OpenMPIRBuilder::createParallel outlines the body region of the parallel
construct into a new function that accepts any value previously defined outside
the region as a function argument. This function is called back by OpenMP
runtime function __kmpc_fork_call, which expects trailing arguments to be
pointers. If the region uses a value that is not of a pointer type, e.g. a
struct, the produced code would be invalid. In such cases, make createParallel
emit IR that stores the value on stack and pass the pointer to the outlined
function instead. The outlined function then loads the value back and uses as
normal.

Reviewed By: jdoerfert, llitchev

Differential Revision: https://reviews.llvm.org/D92189




More information about the All-commits mailing list