summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExpr.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2019-12-27 09:44:43 -0500
committerAlexey Bataev <a.bataev@hotmail.com>2020-01-02 16:43:00 -0500
commita58da1a2ff039dd3bb4c43db3919995cf4a74cc7 (patch)
tree5406d1d48fa4cc0a70fd8cb4aa8668bac245b627 /clang/lib/CodeGen/CGExpr.cpp
parentf83801fb2a4064d666cf8c17d716376a99e4a555 (diff)
downloadbcm5719-llvm-a58da1a2ff039dd3bb4c43db3919995cf4a74cc7.tar.gz
bcm5719-llvm-a58da1a2ff039dd3bb4c43db3919995cf4a74cc7.zip
[OPENMP50]Codegen for lastprivate conditional list items.
Added codegen support for lastprivate conditional. According to the standard, if when the conditional modifier appears on the clause, if an assignment to a list item is encountered in the construct then the original list item is assigned the value that is assigned to the new list item in the sequentially last iteration or lexically last section in which such an assignment is encountered. We look for the assignment operations and check if the left side references lastprivate conditional variable. Then the next code is emitted: if (last_iv_a <= iv) { last_iv_a = iv; last_a = lp_a; } At the end the implicit barrier is generated to wait for the end of all threads and then in the check for the last iteration the private copy is assigned the last value. if (last_iter) { lp_a = last_a; // <--- new code a = lp_a; // <--- store of private value to the original variable. }
Diffstat (limited to 'clang/lib/CodeGen/CGExpr.cpp')
-rw-r--r--clang/lib/CodeGen/CGExpr.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index c729037852e..e43ed5030bc 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -4717,6 +4717,9 @@ LValue CodeGenFunction::EmitBinaryOperatorLValue(const BinaryOperator *E) {
if (RV.isScalar())
EmitNullabilityCheck(LV, RV.getScalarVal(), E->getExprLoc());
EmitStoreThroughLValue(RV, LV);
+ if (getLangOpts().OpenMP)
+ CGM.getOpenMPRuntime().checkAndEmitLastprivateConditional(*this,
+ E->getLHS());
return LV;
}
OpenPOWER on IntegriCloud