[PATCH] D81483: [Clang][OpenMP][OMPBuilder] (3/4) Privatize `parallel` for `OMPBuilder`

2020-06-09 Thread Fady Ghanim via Phabricator via cfe-commits
fghanim marked 3 inline comments as done.
fghanim added inline comments.



Comment at: clang/lib/CodeGen/CGStmtOpenMP.cpp:1554
  llvm::SmallVectorImpl &) {}
 
+bool CodeGenFunction::OMPBuilderCBHelpers::EmitOMPCopyinClause(

Note to reviewers:
This keeps most of old implementation of `copyin` clause, except it uses part 
of the `OMPBuilder` now. Changes are noted below.



Comment at: clang/lib/CodeGen/CGStmtOpenMP.cpp:1582
+  assert(CGF.CapturedStmtInfo->lookup(VD) &&
+ "Copyin threadprivates should have been captured!");
+  const auto *VDCanon = VD->getCanonicalDecl();

added following few lines



Comment at: clang/lib/CodeGen/CGStmtOpenMP.cpp:1600
+}
+
+// Get the address of the threadprivate variable.

Wherever needed - changed the following section to use `OMPBuilder`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81483/new/

https://reviews.llvm.org/D81483



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D81483: [Clang][OpenMP][OMPBuilder] (3/4) Privatize `parallel` for `OMPBuilder`

2020-06-09 Thread Fady Ghanim via Phabricator via cfe-commits
fghanim created this revision.
fghanim added a reviewer: jdoerfert.
Herald added subscribers: cfe-commits, aaron.ballman, sstefan1, guansong, 
yaxunl.
Herald added a project: clang.
fghanim added a child revision: D79677: [clang][OpenMP][OMPIRBuilder] Adding 
some Privatization clauses to OpenMP `parallel` Directive.
fghanim added a parent revision: D79676: [Clang][OpenMP][OMPBuilder] Moving OMP 
allocation and cache creation code to OMPBuilderCBHelpers.
fghanim marked 3 inline comments as done.
fghanim added inline comments.



Comment at: clang/lib/CodeGen/CGStmtOpenMP.cpp:1554
  llvm::SmallVectorImpl &) {}
 
+bool CodeGenFunction::OMPBuilderCBHelpers::EmitOMPCopyinClause(

Note to reviewers:
This keeps most of old implementation of `copyin` clause, except it uses part 
of the `OMPBuilder` now. Changes are noted below.



Comment at: clang/lib/CodeGen/CGStmtOpenMP.cpp:1582
+  assert(CGF.CapturedStmtInfo->lookup(VD) &&
+ "Copyin threadprivates should have been captured!");
+  const auto *VDCanon = VD->getCanonicalDecl();

added following few lines



Comment at: clang/lib/CodeGen/CGStmtOpenMP.cpp:1600
+}
+
+// Get the address of the threadprivate variable.

Wherever needed - changed the following section to use `OMPBuilder`


Adding support / implementation for `copyin` in OMPBuilder's
implementation of `omp parallel`


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81483

Files:
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/test/OpenMP/parallel_copyin_codegen.cpp

Index: clang/test/OpenMP/parallel_copyin_codegen.cpp
===
--- clang/test/OpenMP/parallel_copyin_codegen.cpp
+++ clang/test/OpenMP/parallel_copyin_codegen.cpp
@@ -1,9 +1,12 @@
-// RUN: %clang_cc1 -verify -fopenmp -fnoopenmp-use-tls -x c++ -triple x86_64-linux -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -verify -fopenmp -fnoopenmp-use-tls -x c++ -triple x86_64-linux -emit-llvm %s -o - | FileCheck %s -check-prefixes=ALL,CHECK
 // RUN: %clang_cc1 -fopenmp -fnoopenmp-use-tls -x c++ -std=c++11 -triple x86_64-linux -emit-pch -o %t %s
-// RUN: %clang_cc1 -fopenmp -fnoopenmp-use-tls -x c++ -triple x86_64-linux -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -fopenmp -fnoopenmp-use-tls -x c++ -triple x86_64-linux -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s -check-prefixes=ALL,CHECK
 // RUN: %clang_cc1 -verify -fopenmp -fnoopenmp-use-tls -x c++ -std=c++11 -DLAMBDA -triple x86_64-linux -emit-llvm %s -o - | FileCheck -check-prefix=LAMBDA %s
 // RUN: %clang_cc1 -verify -fopenmp -fnoopenmp-use-tls -x c++ -fblocks -DBLOCKS -triple x86_64-linux -emit-llvm %s -o - | FileCheck -check-prefix=BLOCKS %s
 // RUN: %clang_cc1 -verify -fopenmp -fnoopenmp-use-tls -x c++ -std=c++11 -DARRAY -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck -check-prefix=ARRAY %s
+// RUN: %clang_cc1 -verify -fopenmp -fopenmp-enable-irbuilder -fnoopenmp-use-tls -x c++ -triple x86_64-linux -emit-llvm %s -o - | FileCheck %s -check-prefixes=ALL,IRBUILDER
+// RUN: %clang_cc1 -fopenmp -fopenmp-enable-irbuilder -fnoopenmp-use-tls -x c++ -std=c++11 -triple x86_64-linux -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-enable-irbuilder -fnoopenmp-use-tls -x c++ -triple x86_64-linux -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s -check-prefixes=ALL,IRBUILDER
 
 // RUN: %clang_cc1 -verify -fopenmp-simd -fnoopenmp-use-tls -x c++ -triple x86_64-linux -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s
 // RUN: %clang_cc1 -fopenmp-simd -fnoopenmp-use-tls -x c++ -std=c++11 -triple x86_64-linux -emit-pch -o %t %s
@@ -46,21 +49,22 @@
   ~S() {}
 };
 
-// CHECK-DAG: [[S_FLOAT_TY:%.+]] = type { float }
-// CHECK-DAG: [[S_INT_TY:%.+]] = type { i{{[0-9]+}} }
+// ALL-DAG: [[S_FLOAT_TY:%.+]] = type { float }
+// ALL-DAG: [[S_INT_TY:%.+]] = type { i{{[0-9]+}} }
 // CHECK-DAG: [[IMPLICIT_BARRIER_LOC:@.+]] = private unnamed_addr global %{{.+}} { i32 0, i32 66, i32 0, i32 0, i8*
+// IRBUILDER-DAG: [[IMPLICIT_BARRIER_LOC:@.+]] = private unnamed_addr global %{{.+}} { i32 0, i32 34, i32 0, i32 0, i8*
 // TLS-CHECK-DAG: [[S_FLOAT_TY:%.+]] = type { float }
 // TLS-CHECK-DAG: [[S_INT_TY:%.+]] = type { i{{[0-9]+}} }
 // TLS-CHECK-DAG: [[IMPLICIT_BARRIER_LOC:@.+]] = private unnamed_addr global %{{.+}} { i32 0, i32 66, i32 0, i32 0, i8*
 
-// CHECK-DAG: [[T_VAR:@.+]] = internal global i{{[0-9]+}} 1122,
-// CHECK-DAG: [[VEC:@.+]] = internal global [2 x i{{[0-9]+}}] [i{{[0-9]+}} 1, i{{[0-9]+}} 2],
-// CHECK-DAG: [[S_ARR:@.+]] = internal global [2 x [[S_FLOAT_TY]]] zeroinitializer,
-// CHECK-DAG: [[VAR:@.+]] = internal global [[S_FLOAT_TY]] zeroinitializer,
-// CHECK-DAG: [[TMAIN_T_VAR:@.+]] = linkonce_odr