================
@@ -2332,6 +2332,12 @@ void CodeGenFunction::EmitOMPPrivateLoopCounters(
   for (const Expr *E : S.counters()) {
     const auto *VD = cast<VarDecl>(cast<DeclRefExpr>(E)->getDecl());
     const auto *PrivateVD = cast<VarDecl>(cast<DeclRefExpr>(*I)->getDecl());
+    // Privatize original counter variable (e.g., __beginN, __endN, __rangeN)
+    if (!LocalDeclMap.count(VD)) {
+      Address Addr = CreateMemTemp(VD->getType(), VD->getName());
+      LocalDeclMap.insert({VD, Addr});
+      (void)LoopScope.addPrivate(VD, Addr);
+    }
----------------
alexey-bataev wrote:

I assume this is too broad. Why the original variables are not captured and 
privatized? Looks like we're missing some analysis

https://github.com/llvm/llvm-project/pull/146772
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to