From 70198750b9b77147a123f948252a51d04d5c6b28 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Tue, 11 Jun 2019 18:16:50 +0000 Subject: Vendor import of clang release_80 branch r363030: https://llvm.org/svn/llvm-project/cfe/branches/release_80@363030 --- lib/CodeGen/CGStmtOpenMP.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/CodeGen/CGStmtOpenMP.cpp') diff --git a/lib/CodeGen/CGStmtOpenMP.cpp b/lib/CodeGen/CGStmtOpenMP.cpp index eb1304d89345e..44dc1cdee0b53 100644 --- a/lib/CodeGen/CGStmtOpenMP.cpp +++ b/lib/CodeGen/CGStmtOpenMP.cpp @@ -1518,8 +1518,9 @@ void CodeGenFunction::EmitOMPPrivateLoopCounters( I < E; ++I) { const auto *DRE = cast(C->getLoopCounter(I)); const auto *VD = cast(DRE->getDecl()); - // Override only those variables that are really emitted already. - if (LocalDeclMap.count(VD)) { + // Override only those variables that can be captured to avoid re-emission + // of the variables declared within the loops. + if (DRE->refersToEnclosingVariableOrCapture()) { (void)LoopScope.addPrivate(VD, [this, DRE, VD]() { return CreateMemTemp(DRE->getType(), VD->getName()); }); -- cgit v1.3