[all-commits] [llvm/llvm-project] f9c3c5: [OpenMP][IR-Builder] Introduce the finalization stack

Johannes Doerfert via All-commits all-commits at lists.llvm.org
Wed Dec 25 14:57:49 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: f9c3c5da19ab6d8cbbd4611fbb24e97fe7a85078
      https://github.com/llvm/llvm-project/commit/f9c3c5da19ab6d8cbbd4611fbb24e97fe7a85078
  Author: Johannes Doerfert <johannes at jdoerfert.de>
  Date:   2019-12-25 (Wed, 25 Dec 2019)

  Changed paths:
    M clang/lib/CodeGen/CGOpenMPRuntime.cpp
    M llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
    M llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
    M llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp

  Log Message:
  -----------
  [OpenMP][IR-Builder] Introduce the finalization stack

As a permanent and generic solution to the problem of variable
finalization (destructors, lastprivate, ...), this patch introduces the
finalization stack. The objects on the stack describe (1) the
(structured) regions the OpenMP-IR-Builder is currently constructing,
(2) if these are cancellable, and (3) the callback that will perform the
finalization (=cleanup) when necessary.

As the finalization can be necessary multiple times, at different source
locations, the callback takes the position at which code is currently
generated. This position will also encode the destination of the "region
exit" block *iff* the finalization call was issues for a region
generated by the OpenMPIRBuilder. For regions generated through the old
Clang OpenMP code geneneration, the "region exit" is determined by Clang
inside the finalization call instead (see getOMPCancelDestination).

As a first user, the parallel + cancel barrier interaction is changed.
In contrast to the temporary solution before, the barrier generation in
Clang does not need to be aware of the "CancelDestination" block.
Instead, the finalization callback is and, as described above, later
even that one does not need to be.

D70109 will be updated to use this scheme.

Reviewed By: ABataev

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




More information about the All-commits mailing list