diff options
| author | Alexey Bataev <a.bataev@hotmail.com> | 2017-12-08 20:18:58 +0000 |
|---|---|---|
| committer | Alexey Bataev <a.bataev@hotmail.com> | 2017-12-08 20:18:58 +0000 |
| commit | e83b3e89e68397934784f898f46fa93d0006cfa0 (patch) | |
| tree | 9df7191ec3d1b00463a4872d5f1a5339f2adc182 /clang/lib | |
| parent | 7f0d456ef8b2500257f3ed9b936fb014fbd29b8b (diff) | |
| download | bcm5719-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.cpp | 7 |
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())) { |

