================
@@ -1217,17 +1223,20 @@ class CodeGenFunction : public CodeGenTypeCache {
     OMPMapVars MappedVars;
     OMPPrivateScope(const OMPPrivateScope &) = delete;
     void operator=(const OMPPrivateScope &) = delete;
+    llvm::DenseMap<const BindingDecl *, Address> SavedBindings;
 
   public:
     /// Enter a new OpenMP private scope.
-    explicit OMPPrivateScope(CodeGenFunction &CGF) : RunCleanupsScope(CGF) {}
+    explicit OMPPrivateScope(CodeGenFunction &CGF) : RunCleanupsScope(CGF) {
+      SavedBindings = CGF.OMPPrivatizedBindings;
----------------
alexey-bataev wrote:

This copies the entire OMPPrivatizedBindings DenseMap on every scope entry. For 
deeply nested OpenMP regions with many bindings, this is O(n) per scope. 
Consider a save/restore scheme that only tracks entries that change (similar to 
OMPMapVars::SavedLocals), or at minimum use std::move in the destructor and 
swap in the constructor.

https://github.com/llvm/llvm-project/pull/190832
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to