summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2018-02-15 23:39:43 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2018-02-15 23:39:43 +0000
commitea33dee38c86348bdad35c68aed64b9fbcd47be5 (patch)
tree9398b66eae7b38eff0a9f88da6cff2c6eaa9f1f8 /clang/lib/CodeGen
parentd345f7393914cb4a57b079836f0723002a06cc71 (diff)
downloadbcm5719-llvm-ea33dee38c86348bdad35c68aed64b9fbcd47be5.tar.gz
bcm5719-llvm-ea33dee38c86348bdad35c68aed64b9fbcd47be5.zip
[OPENMP] Fix PR36399: Crash on C code with ordered doacross construct.
Codegen for ordered with doacross construct might produce incorrect code because of missing cleanup scope for the construct. Without this scope the final runtime function call could be emitted in the wrong order that leads to incorrect codegen. llvm-svn: 325304
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGStmtOpenMP.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index 052ebcaf389..b4cc7ad63ce 100644
--- a/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -2230,6 +2230,7 @@ bool CodeGenFunction::EmitOMPWorksharingLoop(
incrementProfileCounter(&S);
}
+ RunCleanupsScope DoacrossCleanupScope(*this);
bool Ordered = false;
if (auto *OrderedClause = S.getSingleClause<OMPOrderedClause>()) {
if (OrderedClause->getNumForLoops())
@@ -2366,6 +2367,7 @@ bool CodeGenFunction::EmitOMPWorksharingLoop(
return CGF.Builder.CreateIsNotNull(
CGF.EmitLoadOfScalar(IL, S.getLocStart()));
});
+ DoacrossCleanupScope.ForceCleanup();
// We're now done with the loop, so jump to the continuation block.
if (ContBlock) {
EmitBranch(ContBlock);
OpenPOWER on IntegriCloud