diff options
author | Johannes Doerfert <johannes@jdoerfert.de> | 2021-01-08 10:30:28 -0600 |
---|---|---|
committer | Johannes Doerfert <johannes@jdoerfert.de> | 2021-01-25 22:43:37 -0600 |
commit | bd756286d2e774716a12f55db27d070595058d53 (patch) | |
tree | d4113ba31f89197a9c89fd8f02e116760a89789e /clang/lib/CodeGen/CGOpenMPRuntime.cpp | |
parent | [RISCV] Update V extension to v1.0-draft 08a0b464. (diff) | |
download | llvm-project-bd756286d2e774716a12f55db27d070595058d53.tar.gz llvm-project-bd756286d2e774716a12f55db27d070595058d53.tar.bz2 llvm-project-bd756286d2e774716a12f55db27d070595058d53.zip |
[OpenMP][FIX] Enforce a function boundary for a new data environment
Whenever we enter a new OpenMP data environment we want to enter a
function to simplify reasoning. Later we probably want to remove the
entire specialization wrt. the if clause and pass the result to the
runtime, for now this should fix PR48686.
Reviewed By: ABataev
Differential Revision: https://reviews.llvm.org/D94315
Diffstat (limited to 'clang/lib/CodeGen/CGOpenMPRuntime.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGOpenMPRuntime.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp index 7a69fe2c013f..57cc2d60e2af 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp @@ -2098,6 +2098,14 @@ void CGOpenMPRuntime::emitParallelCall(CodeGenFunction &CGF, SourceLocation Loc, OutlinedFnArgs.push_back(ThreadIDAddr.getPointer()); OutlinedFnArgs.push_back(ZeroAddrBound.getPointer()); OutlinedFnArgs.append(CapturedVars.begin(), CapturedVars.end()); + + // Ensure we do not inline the function. This is trivially true for the ones + // passed to __kmpc_fork_call but the ones calles in serialized regions + // could be inlined. This is not a perfect but it is closer to the invariant + // we want, namely, every data environment starts with a new function. + // TODO: We should pass the if condition to the runtime function and do the + // handling there. Much cleaner code. + OutlinedFn->addFnAttr(llvm::Attribute::NoInline); RT.emitOutlinedFunctionCall(CGF, Loc, OutlinedFn, OutlinedFnArgs); // __kmpc_end_serialized_parallel(&Loc, GTid); |