diff options
author | Johannes Doerfert <johannes@jdoerfert.de> | 2020-02-10 14:28:47 -0600 |
---|---|---|
committer | Johannes Doerfert <johannes@jdoerfert.de> | 2020-02-12 17:55:01 -0600 |
commit | 8a56d64d7620b3764f10f03f3a1e307fcdd72c2f (patch) | |
tree | 5266907a6e2f8e6d6ca36108aa08cee542620429 /clang/lib/CodeGen/CodeGenFunction.cpp | |
parent | 77b2ffc498e92cce7546d191f6712a3046300501 (diff) | |
download | llvm-8a56d64d7620b3764f10f03f3a1e307fcdd72c2f.zip llvm-8a56d64d7620b3764f10f03f3a1e307fcdd72c2f.tar.gz llvm-8a56d64d7620b3764f10f03f3a1e307fcdd72c2f.tar.bz2 |
[OpenMP][IRBuilder] Perform finalization (incl. outlining) late
In order to fix PR44560 and to prepare for loop transformations we now
finalize a function late, which will also do the outlining late. The
logic is as before but the actual outlining step happens now after the
function was fully constructed. Once we have loop transformations we
can apply them in the finalize step before the outlining.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D74372
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index b7506b5..4798de0 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -32,6 +32,7 @@ #include "clang/Basic/TargetInfo.h" #include "clang/CodeGen/CGFunctionInfo.h" #include "clang/Frontend/FrontendDiagnostic.h" +#include "llvm/Frontend/OpenMP/OMPIRBuilder.h" #include "llvm/IR/DataLayout.h" #include "llvm/IR/Dominators.h" #include "llvm/IR/FPEnv.h" @@ -104,6 +105,14 @@ CodeGenFunction::~CodeGenFunction() { if (getLangOpts().OpenMP && CurFn) CGM.getOpenMPRuntime().functionFinished(*this); + + // If we have an OpenMPIRBuilder we want to finalize functions (incl. + // outlining etc) at some point. Doing it once the function codegen is done + // seems to be a reasonable spot. We do it here, as opposed to the deletion + // time of the CodeGenModule, because we have to ensure the IR has not yet + // been "emitted" to the outside, thus, modifications are still sensible. + if (llvm::OpenMPIRBuilder *OMPBuilder = CGM.getOpenMPIRBuilder()) + OMPBuilder->finalize(); } // Map the LangOption for rounding mode into |