summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2017-12-08 20:18:58 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2017-12-08 20:18:58 +0000
commite83b3e89e68397934784f898f46fa93d0006cfa0 (patch)
tree9df7191ec3d1b00463a4872d5f1a5339f2adc182 /clang/lib
parent7f0d456ef8b2500257f3ed9b936fb014fbd29b8b (diff)
downloadbcm5719-llvm-e83b3e89e68397934784f898f46fa93d0006cfa0.tar.gz
bcm5719-llvm-e83b3e89e68397934784f898f46fa93d0006cfa0.zip
[OPENMP] Simplify codegen for loop iteration variables in loop preamble.
Initial patch could cause trouble in the optimized code because of the incorrectly generated lifetime intrinsics. llvm-svn: 320191
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/CodeGen/CGStmtOpenMP.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index 045c88f6309..ad177b752db 100644
--- a/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -122,7 +122,12 @@ public:
class OMPLoopScope : public CodeGenFunction::RunCleanupsScope {
void emitPreInitStmt(CodeGenFunction &CGF, const OMPLoopDirective &S) {
CodeGenFunction::OMPPrivateScope PreCondScope(CGF);
- CGF.EmitOMPPrivateLoopCounters(S, PreCondScope);
+ for (auto *E : S.counters()) {
+ const auto *VD = cast<VarDecl>(cast<DeclRefExpr>(E)->getDecl());
+ (void)PreCondScope.addPrivate(VD, [&CGF, VD]() {
+ return CGF.CreateMemTemp(VD->getType().getNonReferenceType());
+ });
+ }
(void)PreCondScope.Privatize();
if (auto *LD = dyn_cast<OMPLoopDirective>(&S)) {
if (auto *PreInits = cast_or_null<DeclStmt>(LD->getPreInits())) {
OpenPOWER on IntegriCloud