[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2022-04-06 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis added a comment.

In D102107#3417452 , @dhruvachak 
wrote:

> I added https://github.com/llvm/llvm-project/issues/54654 documenting what I 
> found when testing this patch on amdgpu.
>
> @ggeorgakoudis Can you please rebase this patch on top of main? Thanks.

Hey @dhruvachak. Unfortunately I can't find time lately to work on this patch. 
Would you like to take over?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

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


[PATCH] D120573: [OpenMP] Support runtime user conditions in metadirective

2022-04-05 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis added a comment.

In D120573#3415517 , 
@abidmalikwaterloo wrote:

> Are you going to work on it? Just confirming. I am working on D122255 
> . The code generation part for the dynamic 
> condition is useful. However, my understanding is that it is not according to 
> the OpenMP 5.2 specification. Correct me if I am wrong.

I'm happy if you'd like to take over in your patch. I'm not sure what is the 
issue with the OpenMP 5.2 but feel free to re-use/modify parts of this patch. 
One thing that is problematic with this patch is the need to re-set the tokens 
in the lexer/parser to their unannotated versions when tentative parsing. The 
code in the patch is not fault-proof but I have an update for that that I can 
post, if that's useful. In D122255  I see 
you're taking the route of parsing the associated statement which has its own 
pitfalls but maybe that's the best approach.




Comment at: clang/lib/CodeGen/CGStmtOpenMP.cpp:1852
+int BestIdx = getBestVariantMatchForContext(StaticVMIs, OMPCtx);
+
+EmitStmt(StaticWhenClauses[BestIdx]->getDirective());

abidmalikwaterloo wrote:
> ggeorgakoudis wrote:
> > abidmalikwaterloo wrote:
> > > This approach is valid for static conditions. How you are going to take 
> > > care of multiple dynamic/runtime conditions?
> > See GenerateCond that creates code for dynamic conditions. If the when 
> > clause has dynamically evaluated conditions it generates basicblocks and 
> > control logic.
> Why get a score for static when clauses for the best clause? Is it according 
> to OpenMP specification?
Because if no runtime conditions evaluate to true then it falls back to the 
static when with the highest score. I'm not sure about the OpenMP 
specification. Do you have an example? Could you point me to the related part 
in the specification it fails to conform to?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120573

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


[PATCH] D120573: [OpenMP] Support runtime user conditions in metadirective

2022-03-23 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis added inline comments.



Comment at: clang/lib/CodeGen/CGStmtOpenMP.cpp:1793
+void CodeGenFunction::EmitOMPMetaDirective(const OMPMetaDirective ) {
+  llvm::BasicBlock *AfterBlock =
+  createBasicBlock("omp.meta.user.condition.after");

abidmalikwaterloo wrote:
> Why are you skipping the AST building part? Any special significance of this 
> approach?
I don't understand the question, what do you mean by that? Emit generates code 
to handle dynamic and static conditions based on the when clauses



Comment at: clang/lib/CodeGen/CGStmtOpenMP.cpp:1852
+int BestIdx = getBestVariantMatchForContext(StaticVMIs, OMPCtx);
+
+EmitStmt(StaticWhenClauses[BestIdx]->getDirective());

abidmalikwaterloo wrote:
> This approach is valid for static conditions. How you are going to take care 
> of multiple dynamic/runtime conditions?
See GenerateCond that creates code for dynamic conditions. If the when clause 
has dynamically evaluated conditions it generates basicblocks and control logic.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120573

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


[PATCH] D120573: [OpenMP] Support runtime user conditions in metadirective

2022-03-09 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 414139.
ggeorgakoudis added a comment.
Herald added subscribers: kbarton, nemanjai.

Fix tentative parsing reverting
Fix device codegen for metadirectives


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120573

Files:
  clang/include/clang/AST/OpenMPClause.h
  clang/include/clang/AST/RecursiveASTVisitor.h
  clang/include/clang/AST/StmtOpenMP.h
  clang/include/clang/Lex/Preprocessor.h
  clang/include/clang/Parse/Parser.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/OpenMPClause.cpp
  clang/lib/AST/StmtOpenMP.cpp
  clang/lib/AST/StmtProfile.cpp
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/lib/Lex/PPCaching.cpp
  clang/lib/Parse/ParseOpenMP.cpp
  clang/lib/Sema/SemaOpenMP.cpp
  clang/lib/Sema/TreeTransform.h
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTWriter.cpp
  clang/tools/libclang/CIndex.cpp
  llvm/include/llvm/Frontend/OpenMP/OMP.td

Index: llvm/include/llvm/Frontend/OpenMP/OMP.td
===
--- llvm/include/llvm/Frontend/OpenMP/OMP.td
+++ llvm/include/llvm/Frontend/OpenMP/OMP.td
@@ -368,7 +368,9 @@
 def OMPC_Align : Clause<"align"> {
   let clangClass = "OMPAlignClause";
 }
-def OMPC_When: Clause<"when"> {}
+def OMPC_When: Clause<"when"> {
+  let clangClass = "OMPWhenClause";
+}
 
 def OMPC_Bind : Clause<"bind"> {
   let clangClass = "OMPBindClause";
Index: clang/tools/libclang/CIndex.cpp
===
--- clang/tools/libclang/CIndex.cpp
+++ clang/tools/libclang/CIndex.cpp
@@ -2591,6 +2591,10 @@
 }
 void OMPClauseEnqueue::VisitOMPBindClause(const OMPBindClause *C) {}
 
+void OMPClauseEnqueue::VisitOMPWhenClause(const OMPWhenClause *C) {
+  Visitor->AddStmt(C->getDirective());
+}
+
 } // namespace
 
 void EnqueueVisitor::EnqueueChildren(const OMPClause *S) {
Index: clang/lib/Serialization/ASTWriter.cpp
===
--- clang/lib/Serialization/ASTWriter.cpp
+++ clang/lib/Serialization/ASTWriter.cpp
@@ -6864,6 +6864,12 @@
   Record.AddSourceLocation(C->getBindKindLoc());
 }
 
+void OMPClauseWriter::VisitOMPWhenClause(OMPWhenClause *C) {
+  // TODO: check, not familiar with this.
+  Record.writeOMPTraitInfo(>getTraitInfo());
+  Record.AddStmt(C->getDirective());
+}
+
 void ASTRecordWriter::writeOMPTraitInfo(const OMPTraitInfo *TI) {
   writeUInt32(TI->Sets.size());
   for (const auto  : TI->Sets) {
Index: clang/lib/Serialization/ASTReader.cpp
===
--- clang/lib/Serialization/ASTReader.cpp
+++ clang/lib/Serialization/ASTReader.cpp
@@ -12994,6 +12994,12 @@
   C->setBindKindLoc(Record.readSourceLocation());
 }
 
+void OMPClauseReader::VisitOMPWhenClause(OMPWhenClause *C) {
+  // TODO: check, not familiar with this.
+  C->setTraitInfo(Record.readOMPTraitInfo());
+  C->setDirective(Record.readStmt());
+}
+
 void OMPClauseReader::VisitOMPAlignClause(OMPAlignClause *C) {
   C->setAlignment(Record.readExpr());
   C->setLParenLoc(Record.readSourceLocation());
Index: clang/lib/Sema/TreeTransform.h
===
--- clang/lib/Sema/TreeTransform.h
+++ clang/lib/Sema/TreeTransform.h
@@ -2284,6 +2284,18 @@
 return getSema().ActOnOpenMPAlignClause(A, StartLoc, LParenLoc, EndLoc);
   }
 
+  /// Build a new OpenMP 'when' clause.
+  ///
+  /// By default, performs semantic analysis to build the new OpenMP clause.
+  /// Subclasses may override this routine to provide different behavior.
+  OMPClause *RebuildOMPWhenClause(OMPTraitInfo , Stmt *Directive,
+  SourceLocation StartLoc,
+  SourceLocation LParenLoc,
+  SourceLocation EndLoc) {
+return getSema().ActOnOpenMPWhenClause(TI, Directive, StartLoc, LParenLoc,
+   EndLoc);
+  }
+
   /// Rebuild the operand to an Objective-C \@synchronized statement.
   ///
   /// By default, performs semantic analysis to build the new statement.
@@ -10323,6 +10335,13 @@
   C->getLParenLoc(), C->getEndLoc());
 }
 
+template 
+OMPClause *TreeTransform::TransformOMPWhenClause(OMPWhenClause *C) {
+  return getDerived().RebuildOMPWhenClause(C->getTraitInfo(), C->getDirective(),
+   C->getBeginLoc(), C->getLParenLoc(),
+   C->getEndLoc());
+}
+
 //===--===//
 // Expression transformation
 //===--===//
Index: clang/lib/Sema/SemaOpenMP.cpp
===
--- clang/lib/Sema/SemaOpenMP.cpp
+++ 

[PATCH] D120573: [OpenMP] Support runtime user conditions in metadirective

2022-02-25 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis created this revision.
Herald added subscribers: arphaman, guansong, yaxunl.
ggeorgakoudis requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: llvm-commits, cfe-commits, sstefan1.
Herald added projects: clang, LLVM.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D120573

Files:
  clang/include/clang/AST/OpenMPClause.h
  clang/include/clang/AST/RecursiveASTVisitor.h
  clang/include/clang/AST/StmtOpenMP.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/OpenMPClause.cpp
  clang/lib/AST/StmtOpenMP.cpp
  clang/lib/AST/StmtProfile.cpp
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/lib/Parse/ParseOpenMP.cpp
  clang/lib/Sema/SemaOpenMP.cpp
  clang/lib/Sema/TreeTransform.h
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTWriter.cpp
  clang/tools/libclang/CIndex.cpp
  llvm/include/llvm/Frontend/OpenMP/OMP.td

Index: llvm/include/llvm/Frontend/OpenMP/OMP.td
===
--- llvm/include/llvm/Frontend/OpenMP/OMP.td
+++ llvm/include/llvm/Frontend/OpenMP/OMP.td
@@ -368,7 +368,9 @@
 def OMPC_Align : Clause<"align"> {
   let clangClass = "OMPAlignClause";
 }
-def OMPC_When: Clause<"when"> {}
+def OMPC_When: Clause<"when"> {
+  let clangClass = "OMPWhenClause";
+}
 
 def OMPC_Bind : Clause<"bind"> {
   let clangClass = "OMPBindClause";
Index: clang/tools/libclang/CIndex.cpp
===
--- clang/tools/libclang/CIndex.cpp
+++ clang/tools/libclang/CIndex.cpp
@@ -2591,6 +2591,10 @@
 }
 void OMPClauseEnqueue::VisitOMPBindClause(const OMPBindClause *C) {}
 
+void OMPClauseEnqueue::VisitOMPWhenClause(const OMPWhenClause *C) {
+  Visitor->AddStmt(C->getDirective());
+}
+
 } // namespace
 
 void EnqueueVisitor::EnqueueChildren(const OMPClause *S) {
Index: clang/lib/Serialization/ASTWriter.cpp
===
--- clang/lib/Serialization/ASTWriter.cpp
+++ clang/lib/Serialization/ASTWriter.cpp
@@ -6864,6 +6864,12 @@
   Record.AddSourceLocation(C->getBindKindLoc());
 }
 
+void OMPClauseWriter::VisitOMPWhenClause(OMPWhenClause *C) {
+  // TODO: check, not familiar with this.
+  Record.writeOMPTraitInfo(>getTraitInfo());
+  Record.AddStmt(C->getDirective());
+}
+
 void ASTRecordWriter::writeOMPTraitInfo(const OMPTraitInfo *TI) {
   writeUInt32(TI->Sets.size());
   for (const auto  : TI->Sets) {
Index: clang/lib/Serialization/ASTReader.cpp
===
--- clang/lib/Serialization/ASTReader.cpp
+++ clang/lib/Serialization/ASTReader.cpp
@@ -12994,6 +12994,12 @@
   C->setBindKindLoc(Record.readSourceLocation());
 }
 
+void OMPClauseReader::VisitOMPWhenClause(OMPWhenClause *C) {
+  // TODO: check, not familiar with this.
+  C->setTraitInfo(Record.readOMPTraitInfo());
+  C->setDirective(Record.readStmt());
+}
+
 void OMPClauseReader::VisitOMPAlignClause(OMPAlignClause *C) {
   C->setAlignment(Record.readExpr());
   C->setLParenLoc(Record.readSourceLocation());
Index: clang/lib/Sema/TreeTransform.h
===
--- clang/lib/Sema/TreeTransform.h
+++ clang/lib/Sema/TreeTransform.h
@@ -2284,6 +2284,18 @@
 return getSema().ActOnOpenMPAlignClause(A, StartLoc, LParenLoc, EndLoc);
   }
 
+  /// Build a new OpenMP 'when' clause.
+  ///
+  /// By default, performs semantic analysis to build the new OpenMP clause.
+  /// Subclasses may override this routine to provide different behavior.
+  OMPClause *RebuildOMPWhenClause(OMPTraitInfo , Stmt *Directive,
+  SourceLocation StartLoc,
+  SourceLocation LParenLoc,
+  SourceLocation EndLoc) {
+return getSema().ActOnOpenMPWhenClause(TI, Directive, StartLoc, LParenLoc,
+   EndLoc);
+  }
+
   /// Rebuild the operand to an Objective-C \@synchronized statement.
   ///
   /// By default, performs semantic analysis to build the new statement.
@@ -10323,6 +10335,13 @@
   C->getLParenLoc(), C->getEndLoc());
 }
 
+template 
+OMPClause *TreeTransform::TransformOMPWhenClause(OMPWhenClause *C) {
+  return getDerived().RebuildOMPWhenClause(C->getTraitInfo(), C->getDirective(),
+   C->getBeginLoc(), C->getLParenLoc(),
+   C->getEndLoc());
+}
+
 //===--===//
 // Expression transformation
 //===--===//
Index: clang/lib/Sema/SemaOpenMP.cpp
===
--- clang/lib/Sema/SemaOpenMP.cpp
+++ clang/lib/Sema/SemaOpenMP.cpp
@@ -21631,3 +21631,17 @@
   return OMPBindClause::Create(Context, Kind, KindLoc, StartLoc, LParenLoc,

[PATCH] D102555: [libclang] Enhance support for source-to-source rewriting

2022-02-24 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis added a comment.

I'm not expert on this to review but I'm interested as a user. @samvv are you 
still working on this? Do you have any input from the community?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102555

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


[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2021-12-01 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 391099.
ggeorgakoudis added a comment.

Rebase, address comment, update few tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/lib/Sema/SemaOpenMP.cpp
  clang/test/AST/ast-dump-openmp-distribute-parallel-for-simd.c
  clang/test/AST/ast-dump-openmp-distribute-parallel-for.c
  clang/test/AST/ast-dump-openmp-target-teams-distribute-parallel-for-simd.c
  clang/test/AST/ast-dump-openmp-target-teams-distribute-parallel-for.c
  clang/test/AST/ast-dump-openmp-teams-distribute-parallel-for-simd.c
  clang/test/AST/ast-dump-openmp-teams-distribute-parallel-for.c
  clang/test/CodeGenCXX/observe-noexcept.cpp
  clang/test/OpenMP/cancel_codegen.cpp
  clang/test/OpenMP/cancellation_point_codegen.cpp
  clang/test/OpenMP/debug-info-complex-byval.cpp
  clang/test/OpenMP/debug-info-openmp-array.cpp
  clang/test/OpenMP/declare_target_codegen_globalization.cpp
  clang/test/OpenMP/declare_variant_construct_codegen_1.c
  clang/test/OpenMP/distribute_codegen.cpp
  clang/test/OpenMP/distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_codegen.cpp
  clang/test/OpenMP/distribute_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_reduction_codegen.cpp
  clang/test/OpenMP/for_firstprivate_codegen.cpp
  clang/test/OpenMP/for_lastprivate_codegen.cpp
  clang/test/OpenMP/for_linear_codegen.cpp
  clang/test/OpenMP/for_private_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen_UDR.cpp
  clang/test/OpenMP/for_reduction_task_codegen.cpp
  clang/test/OpenMP/master_taskloop_in_reduction_codegen.cpp
  clang/test/OpenMP/master_taskloop_simd_in_reduction_codegen.cpp
  clang/test/OpenMP/metadirective_device_kind_codegen.c
  clang/test/OpenMP/metadirective_device_kind_codegen.cpp
  clang/test/OpenMP/metadirective_implementation_codegen.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_lambda_pointer_capturing.cpp
  clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/openmp_win_codegen.cpp
  clang/test/OpenMP/parallel_codegen.cpp
  clang/test/OpenMP/parallel_copyin_codegen.cpp
  clang/test/OpenMP/parallel_firstprivate_codegen.cpp
  clang/test/OpenMP/parallel_for_codegen.cpp
  clang/test/OpenMP/parallel_for_lastprivate_conditional.cpp
  clang/test/OpenMP/parallel_for_linear_codegen.cpp
  clang/test/OpenMP/parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_for_simd_aligned_codegen.cpp
  

[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2021-12-01 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis added a comment.

Ping!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

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


[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2021-11-11 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 386594.
ggeorgakoudis added a comment.
Herald added subscribers: asavonic, ormris.

Update tests
Fix for attributes to kmpc_alloc_aggregate_arg
Do not emit allocations if there are no arguments in the aggregate


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/lib/Sema/SemaOpenMP.cpp
  clang/test/AST/ast-dump-openmp-distribute-parallel-for-simd.c
  clang/test/AST/ast-dump-openmp-distribute-parallel-for.c
  clang/test/AST/ast-dump-openmp-target-teams-distribute-parallel-for-simd.c
  clang/test/AST/ast-dump-openmp-target-teams-distribute-parallel-for.c
  clang/test/AST/ast-dump-openmp-teams-distribute-parallel-for-simd.c
  clang/test/AST/ast-dump-openmp-teams-distribute-parallel-for.c
  clang/test/CodeGenCXX/observe-noexcept.cpp
  clang/test/OpenMP/cancel_codegen.cpp
  clang/test/OpenMP/cancellation_point_codegen.cpp
  clang/test/OpenMP/debug-info-complex-byval.cpp
  clang/test/OpenMP/debug-info-openmp-array.cpp
  clang/test/OpenMP/declare_target_codegen_globalization.cpp
  clang/test/OpenMP/declare_variant_construct_codegen_1.c
  clang/test/OpenMP/distribute_codegen.cpp
  clang/test/OpenMP/distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_codegen.cpp
  clang/test/OpenMP/distribute_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_reduction_codegen.cpp
  clang/test/OpenMP/for_firstprivate_codegen.cpp
  clang/test/OpenMP/for_lastprivate_codegen.cpp
  clang/test/OpenMP/for_linear_codegen.cpp
  clang/test/OpenMP/for_private_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen_UDR.cpp
  clang/test/OpenMP/for_reduction_task_codegen.cpp
  clang/test/OpenMP/master_taskloop_in_reduction_codegen.cpp
  clang/test/OpenMP/master_taskloop_simd_in_reduction_codegen.cpp
  clang/test/OpenMP/metadirective_device_kind_codegen.c
  clang/test/OpenMP/metadirective_device_kind_codegen.cpp
  clang/test/OpenMP/metadirective_implementation_codegen.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_lambda_pointer_capturing.cpp
  clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/openmp_win_codegen.cpp
  clang/test/OpenMP/parallel_codegen.cpp
  clang/test/OpenMP/parallel_copyin_codegen.cpp
  clang/test/OpenMP/parallel_firstprivate_codegen.cpp
  clang/test/OpenMP/parallel_for_codegen.cpp
  clang/test/OpenMP/parallel_for_lastprivate_conditional.cpp
  clang/test/OpenMP/parallel_for_linear_codegen.cpp
  

[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2021-11-09 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis added a comment.

TODO update tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

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


[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2021-11-09 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 385818.
ggeorgakoudis added a comment.

Update the interface for allocating/sharing the struct aggregate
Simplify invoking tasks


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/lib/Sema/SemaOpenMP.cpp
  clang/test/AST/ast-dump-openmp-distribute-parallel-for-simd.c
  clang/test/AST/ast-dump-openmp-distribute-parallel-for.c
  clang/test/AST/ast-dump-openmp-target-teams-distribute-parallel-for-simd.c
  clang/test/AST/ast-dump-openmp-target-teams-distribute-parallel-for.c
  clang/test/AST/ast-dump-openmp-teams-distribute-parallel-for-simd.c
  clang/test/AST/ast-dump-openmp-teams-distribute-parallel-for.c
  clang/test/CodeGenCXX/observe-noexcept.cpp
  
clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.generated.expected
  
clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.no-generated.expected
  llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
  openmp/libomptarget/DeviceRTL/include/Interface.h
  openmp/libomptarget/DeviceRTL/include/generated_microtask_cases.gen
  openmp/libomptarget/DeviceRTL/src/Parallelism.cpp
  openmp/libomptarget/DeviceRTL/src/State.cpp
  openmp/libomptarget/deviceRTLs/common/generated_microtask_cases.gen
  openmp/libomptarget/deviceRTLs/common/src/data_sharing.cu
  openmp/libomptarget/deviceRTLs/common/src/parallel.cu
  openmp/libomptarget/deviceRTLs/common/src/support.cu
  openmp/libomptarget/deviceRTLs/common/support.h
  openmp/libomptarget/deviceRTLs/interface.h
  openmp/libomptarget/utils/generate_microtask_cases.py

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


[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2021-09-29 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis added a comment.

In D102107#3029825 , @pdhaliwal wrote:

> Apologies for late reply. Most of the tests now do not try to call malloc, so 
> no page fault errors. But all of them are producing wrong results. For e.g. 
> declare_mapper_target.cpp produces Sum = 132608 with the patch applied. 
> Similarly for other tests as well. So don't know what's happening yet.

Thanks @pdhaliwal. I get the right result on nvidia. Please let me know when 
you get to the bottom of it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

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


[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2021-09-28 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis added a comment.

In D102107#3028386 , @ronlieb wrote:

> i backed up to your reverted patch, and applied this one.
> I see some new errors
>
>   libomptarget :: amdgcn-amd-amdhsa :: mapping/declare_mapper_target.cpp
>   libomptarget :: amdgcn-amd-amdhsa :: mapping/declare_mapper_target_data.cpp
>   libomptarget :: amdgcn-amd-amdhsa :: 
> mapping/declare_mapper_target_data_enter_exit.cpp
>   libomptarget :: amdgcn-amd-amdhsa :: 
> mapping/declare_mapper_target_update.cpp
>   libomptarget :: amdgcn-amd-amdhsa :: offloading/parallel_offloading_map.cpp
>   libomptarget :: amdgcn-amd-amdhsa :: offloading/taskloop_offload_nowait.cpp
>
> Dont know if Jon is around, so i will ask Singh @pdhaliwal if he can dig into 
> it a bit more.

Hmm, thanks @ronlieb, @pdhaliwal  please let me know what fails.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

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


[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2021-09-28 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis added a comment.

@pdhaliwal @JonChesterfield @ronlieb I updated the aggregate argument memory 
allocation to use an alloca instead of malloc'ing in SPMD mode, which should 
resolve your issue. Could someone please test the updated patch and give me 
feedback before landing?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

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


[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2021-09-28 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 375634.
ggeorgakoudis added a comment.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Update memory allocation for aggregate argument. 
Introduce runtime interface to allocate from local memory, 
when in SPMD mode, or heap, when in generic.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/lib/Sema/SemaOpenMP.cpp
  clang/test/AST/ast-dump-openmp-distribute-parallel-for-simd.c
  clang/test/AST/ast-dump-openmp-distribute-parallel-for.c
  clang/test/AST/ast-dump-openmp-target-teams-distribute-parallel-for-simd.c
  clang/test/AST/ast-dump-openmp-target-teams-distribute-parallel-for.c
  clang/test/AST/ast-dump-openmp-teams-distribute-parallel-for-simd.c
  clang/test/AST/ast-dump-openmp-teams-distribute-parallel-for.c
  clang/test/CodeGenCXX/observe-noexcept.cpp
  clang/test/OpenMP/cancel_codegen.cpp
  clang/test/OpenMP/cancellation_point_codegen.cpp
  clang/test/OpenMP/debug-info-complex-byval.cpp
  clang/test/OpenMP/debug-info-openmp-array.cpp
  clang/test/OpenMP/declare_target_codegen_globalization.cpp
  clang/test/OpenMP/declare_variant_construct_codegen_1.c
  clang/test/OpenMP/distribute_codegen.cpp
  clang/test/OpenMP/distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_codegen.cpp
  clang/test/OpenMP/distribute_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_reduction_codegen.cpp
  clang/test/OpenMP/for_firstprivate_codegen.cpp
  clang/test/OpenMP/for_lastprivate_codegen.cpp
  clang/test/OpenMP/for_linear_codegen.cpp
  clang/test/OpenMP/for_private_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen_UDR.cpp
  clang/test/OpenMP/for_reduction_task_codegen.cpp
  clang/test/OpenMP/master_taskloop_in_reduction_codegen.cpp
  clang/test/OpenMP/master_taskloop_simd_in_reduction_codegen.cpp
  clang/test/OpenMP/metadirective_device_kind_codegen.c
  clang/test/OpenMP/metadirective_device_kind_codegen.cpp
  clang/test/OpenMP/metadirective_implementation_codegen.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/openmp_win_codegen.cpp
  clang/test/OpenMP/parallel_codegen.cpp
  clang/test/OpenMP/parallel_copyin_codegen.cpp
  clang/test/OpenMP/parallel_firstprivate_codegen.cpp
  clang/test/OpenMP/parallel_for_codegen.cpp
  clang/test/OpenMP/parallel_for_lastprivate_conditional.cpp
  clang/test/OpenMP/parallel_for_linear_codegen.cpp
  

[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2021-09-21 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis added a comment.

In D102107#3013233 , @ronlieb wrote:

> seeing buildbot failures after this patch landed 
> https://lab.llvm.org/staging/#/builders/183/builds/1598

Looking it at @ronlieb, thanks for reporting


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

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


[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2021-09-21 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1d66649adf28: [OpenMP] Codegen aggregate for outlined 
function captures (authored by ggeorgakoudis).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/lib/Sema/SemaOpenMP.cpp
  clang/test/AST/ast-dump-openmp-distribute-parallel-for-simd.c
  clang/test/AST/ast-dump-openmp-distribute-parallel-for.c
  clang/test/AST/ast-dump-openmp-target-teams-distribute-parallel-for-simd.c
  clang/test/AST/ast-dump-openmp-target-teams-distribute-parallel-for.c
  clang/test/AST/ast-dump-openmp-teams-distribute-parallel-for-simd.c
  clang/test/AST/ast-dump-openmp-teams-distribute-parallel-for.c
  clang/test/CodeGenCXX/observe-noexcept.cpp
  clang/test/OpenMP/cancel_codegen.cpp
  clang/test/OpenMP/cancellation_point_codegen.cpp
  clang/test/OpenMP/debug-info-complex-byval.cpp
  clang/test/OpenMP/debug-info-openmp-array.cpp
  clang/test/OpenMP/declare_target_codegen_globalization.cpp
  clang/test/OpenMP/declare_variant_construct_codegen_1.c
  clang/test/OpenMP/distribute_codegen.cpp
  clang/test/OpenMP/distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_codegen.cpp
  clang/test/OpenMP/distribute_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_reduction_codegen.cpp
  clang/test/OpenMP/for_firstprivate_codegen.cpp
  clang/test/OpenMP/for_lastprivate_codegen.cpp
  clang/test/OpenMP/for_linear_codegen.cpp
  clang/test/OpenMP/for_private_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen_UDR.cpp
  clang/test/OpenMP/for_reduction_task_codegen.cpp
  clang/test/OpenMP/master_taskloop_in_reduction_codegen.cpp
  clang/test/OpenMP/master_taskloop_simd_in_reduction_codegen.cpp
  clang/test/OpenMP/metadirective_device_kind_codegen.c
  clang/test/OpenMP/metadirective_device_kind_codegen.cpp
  clang/test/OpenMP/metadirective_implementation_codegen.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/openmp_win_codegen.cpp
  clang/test/OpenMP/parallel_codegen.cpp
  clang/test/OpenMP/parallel_copyin_codegen.cpp
  clang/test/OpenMP/parallel_firstprivate_codegen.cpp
  clang/test/OpenMP/parallel_for_codegen.cpp
  clang/test/OpenMP/parallel_for_lastprivate_conditional.cpp
  clang/test/OpenMP/parallel_for_linear_codegen.cpp
  clang/test/OpenMP/parallel_for_reduction_task_codegen.cpp
  

[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2021-09-21 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 373982.
ggeorgakoudis added a comment.

Rebase and update tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/lib/Sema/SemaOpenMP.cpp
  clang/test/AST/ast-dump-openmp-distribute-parallel-for-simd.c
  clang/test/AST/ast-dump-openmp-distribute-parallel-for.c
  clang/test/AST/ast-dump-openmp-target-teams-distribute-parallel-for-simd.c
  clang/test/AST/ast-dump-openmp-target-teams-distribute-parallel-for.c
  clang/test/AST/ast-dump-openmp-teams-distribute-parallel-for-simd.c
  clang/test/AST/ast-dump-openmp-teams-distribute-parallel-for.c
  clang/test/CodeGenCXX/observe-noexcept.cpp
  clang/test/OpenMP/cancel_codegen.cpp
  clang/test/OpenMP/cancellation_point_codegen.cpp
  clang/test/OpenMP/debug-info-complex-byval.cpp
  clang/test/OpenMP/debug-info-openmp-array.cpp
  clang/test/OpenMP/declare_target_codegen_globalization.cpp
  clang/test/OpenMP/declare_variant_construct_codegen_1.c
  clang/test/OpenMP/distribute_codegen.cpp
  clang/test/OpenMP/distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_codegen.cpp
  clang/test/OpenMP/distribute_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_reduction_codegen.cpp
  clang/test/OpenMP/for_firstprivate_codegen.cpp
  clang/test/OpenMP/for_lastprivate_codegen.cpp
  clang/test/OpenMP/for_linear_codegen.cpp
  clang/test/OpenMP/for_private_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen_UDR.cpp
  clang/test/OpenMP/for_reduction_task_codegen.cpp
  clang/test/OpenMP/master_taskloop_in_reduction_codegen.cpp
  clang/test/OpenMP/master_taskloop_simd_in_reduction_codegen.cpp
  clang/test/OpenMP/metadirective_device_kind_codegen.c
  clang/test/OpenMP/metadirective_device_kind_codegen.cpp
  clang/test/OpenMP/metadirective_implementation_codegen.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/openmp_win_codegen.cpp
  clang/test/OpenMP/parallel_codegen.cpp
  clang/test/OpenMP/parallel_copyin_codegen.cpp
  clang/test/OpenMP/parallel_firstprivate_codegen.cpp
  clang/test/OpenMP/parallel_for_codegen.cpp
  clang/test/OpenMP/parallel_for_lastprivate_conditional.cpp
  clang/test/OpenMP/parallel_for_linear_codegen.cpp
  clang/test/OpenMP/parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_for_simd_aligned_codegen.cpp
  clang/test/OpenMP/parallel_if_codegen.cpp
  

[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2021-09-20 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 373755.
ggeorgakoudis added a comment.

Fix for clang-tidy


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/lib/Sema/SemaOpenMP.cpp
  clang/test/AST/ast-dump-openmp-distribute-parallel-for-simd.c
  clang/test/AST/ast-dump-openmp-distribute-parallel-for.c
  clang/test/AST/ast-dump-openmp-target-teams-distribute-parallel-for-simd.c
  clang/test/AST/ast-dump-openmp-target-teams-distribute-parallel-for.c
  clang/test/AST/ast-dump-openmp-teams-distribute-parallel-for-simd.c
  clang/test/AST/ast-dump-openmp-teams-distribute-parallel-for.c
  clang/test/CodeGenCXX/observe-noexcept.cpp
  clang/test/OpenMP/cancel_codegen.cpp
  clang/test/OpenMP/cancellation_point_codegen.cpp
  clang/test/OpenMP/debug-info-complex-byval.cpp
  clang/test/OpenMP/debug-info-openmp-array.cpp
  clang/test/OpenMP/declare_target_codegen_globalization.cpp
  clang/test/OpenMP/distribute_codegen.cpp
  clang/test/OpenMP/distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_codegen.cpp
  clang/test/OpenMP/distribute_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_reduction_codegen.cpp
  clang/test/OpenMP/for_firstprivate_codegen.cpp
  clang/test/OpenMP/for_lastprivate_codegen.cpp
  clang/test/OpenMP/for_linear_codegen.cpp
  clang/test/OpenMP/for_private_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen_UDR.cpp
  clang/test/OpenMP/for_reduction_task_codegen.cpp
  clang/test/OpenMP/master_taskloop_in_reduction_codegen.cpp
  clang/test/OpenMP/master_taskloop_simd_in_reduction_codegen.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/openmp_win_codegen.cpp
  clang/test/OpenMP/parallel_codegen.cpp
  clang/test/OpenMP/parallel_copyin_codegen.cpp
  clang/test/OpenMP/parallel_firstprivate_codegen.cpp
  clang/test/OpenMP/parallel_for_codegen.cpp
  clang/test/OpenMP/parallel_for_lastprivate_conditional.cpp
  clang/test/OpenMP/parallel_for_linear_codegen.cpp
  clang/test/OpenMP/parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_for_simd_aligned_codegen.cpp
  clang/test/OpenMP/parallel_if_codegen.cpp
  clang/test/OpenMP/parallel_if_codegen_PR51349.cpp
  clang/test/OpenMP/parallel_master_codegen.cpp
  clang/test/OpenMP/parallel_master_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_codegen.cpp
  

[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2021-09-16 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 373107.
ggeorgakoudis added a comment.

Remove unnecessary comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/lib/Sema/SemaOpenMP.cpp
  clang/test/AST/ast-dump-openmp-distribute-parallel-for-simd.c
  clang/test/AST/ast-dump-openmp-distribute-parallel-for.c
  clang/test/AST/ast-dump-openmp-target-teams-distribute-parallel-for-simd.c
  clang/test/AST/ast-dump-openmp-target-teams-distribute-parallel-for.c
  clang/test/AST/ast-dump-openmp-teams-distribute-parallel-for-simd.c
  clang/test/AST/ast-dump-openmp-teams-distribute-parallel-for.c
  clang/test/CodeGenCXX/observe-noexcept.cpp
  clang/test/OpenMP/cancel_codegen.cpp
  clang/test/OpenMP/cancellation_point_codegen.cpp
  clang/test/OpenMP/debug-info-complex-byval.cpp
  clang/test/OpenMP/debug-info-openmp-array.cpp
  clang/test/OpenMP/declare_target_codegen_globalization.cpp
  clang/test/OpenMP/distribute_codegen.cpp
  clang/test/OpenMP/distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_codegen.cpp
  clang/test/OpenMP/distribute_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_reduction_codegen.cpp
  clang/test/OpenMP/for_firstprivate_codegen.cpp
  clang/test/OpenMP/for_lastprivate_codegen.cpp
  clang/test/OpenMP/for_linear_codegen.cpp
  clang/test/OpenMP/for_private_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen_UDR.cpp
  clang/test/OpenMP/for_reduction_task_codegen.cpp
  clang/test/OpenMP/master_taskloop_in_reduction_codegen.cpp
  clang/test/OpenMP/master_taskloop_simd_in_reduction_codegen.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/openmp_win_codegen.cpp
  clang/test/OpenMP/parallel_codegen.cpp
  clang/test/OpenMP/parallel_copyin_codegen.cpp
  clang/test/OpenMP/parallel_firstprivate_codegen.cpp
  clang/test/OpenMP/parallel_for_codegen.cpp
  clang/test/OpenMP/parallel_for_lastprivate_conditional.cpp
  clang/test/OpenMP/parallel_for_linear_codegen.cpp
  clang/test/OpenMP/parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_for_simd_aligned_codegen.cpp
  clang/test/OpenMP/parallel_if_codegen.cpp
  clang/test/OpenMP/parallel_if_codegen_PR51349.cpp
  clang/test/OpenMP/parallel_master_codegen.cpp
  clang/test/OpenMP/parallel_master_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_codegen.cpp
  

[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2021-09-16 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 373105.
ggeorgakoudis added a comment.

Add previous, upper bound to aggregate for combined distributed directives.
Update tests.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/lib/Sema/SemaOpenMP.cpp
  clang/test/AST/ast-dump-openmp-distribute-parallel-for-simd.c
  clang/test/AST/ast-dump-openmp-distribute-parallel-for.c
  clang/test/AST/ast-dump-openmp-target-teams-distribute-parallel-for-simd.c
  clang/test/AST/ast-dump-openmp-target-teams-distribute-parallel-for.c
  clang/test/AST/ast-dump-openmp-teams-distribute-parallel-for-simd.c
  clang/test/AST/ast-dump-openmp-teams-distribute-parallel-for.c
  clang/test/CodeGenCXX/observe-noexcept.cpp
  clang/test/OpenMP/cancel_codegen.cpp
  clang/test/OpenMP/cancellation_point_codegen.cpp
  clang/test/OpenMP/debug-info-complex-byval.cpp
  clang/test/OpenMP/debug-info-openmp-array.cpp
  clang/test/OpenMP/declare_target_codegen_globalization.cpp
  clang/test/OpenMP/distribute_codegen.cpp
  clang/test/OpenMP/distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_codegen.cpp
  clang/test/OpenMP/distribute_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_reduction_codegen.cpp
  clang/test/OpenMP/for_firstprivate_codegen.cpp
  clang/test/OpenMP/for_lastprivate_codegen.cpp
  clang/test/OpenMP/for_linear_codegen.cpp
  clang/test/OpenMP/for_private_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen_UDR.cpp
  clang/test/OpenMP/for_reduction_task_codegen.cpp
  clang/test/OpenMP/master_taskloop_in_reduction_codegen.cpp
  clang/test/OpenMP/master_taskloop_simd_in_reduction_codegen.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/openmp_win_codegen.cpp
  clang/test/OpenMP/parallel_codegen.cpp
  clang/test/OpenMP/parallel_copyin_codegen.cpp
  clang/test/OpenMP/parallel_firstprivate_codegen.cpp
  clang/test/OpenMP/parallel_for_codegen.cpp
  clang/test/OpenMP/parallel_for_lastprivate_conditional.cpp
  clang/test/OpenMP/parallel_for_linear_codegen.cpp
  clang/test/OpenMP/parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_for_simd_aligned_codegen.cpp
  clang/test/OpenMP/parallel_if_codegen.cpp
  clang/test/OpenMP/parallel_if_codegen_PR51349.cpp
  clang/test/OpenMP/parallel_master_codegen.cpp
  clang/test/OpenMP/parallel_master_reduction_task_codegen.cpp
  

[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2021-07-28 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 362305.
ggeorgakoudis added a comment.

Rebase, update tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/test/CodeGenCXX/observe-noexcept.cpp
  clang/test/OpenMP/cancel_codegen.cpp
  clang/test/OpenMP/cancellation_point_codegen.cpp
  clang/test/OpenMP/debug-info-complex-byval.cpp
  clang/test/OpenMP/debug-info-openmp-array.cpp
  clang/test/OpenMP/declare_target_codegen_globalization.cpp
  clang/test/OpenMP/distribute_codegen.cpp
  clang/test/OpenMP/distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_codegen.cpp
  clang/test/OpenMP/distribute_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_reduction_codegen.cpp
  clang/test/OpenMP/for_firstprivate_codegen.cpp
  clang/test/OpenMP/for_lastprivate_codegen.cpp
  clang/test/OpenMP/for_linear_codegen.cpp
  clang/test/OpenMP/for_private_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen_UDR.cpp
  clang/test/OpenMP/for_reduction_task_codegen.cpp
  clang/test/OpenMP/master_taskloop_in_reduction_codegen.cpp
  clang/test/OpenMP/master_taskloop_simd_in_reduction_codegen.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/openmp_win_codegen.cpp
  clang/test/OpenMP/parallel_codegen.cpp
  clang/test/OpenMP/parallel_copyin_codegen.cpp
  clang/test/OpenMP/parallel_firstprivate_codegen.cpp
  clang/test/OpenMP/parallel_for_codegen.cpp
  clang/test/OpenMP/parallel_for_lastprivate_conditional.cpp
  clang/test/OpenMP/parallel_for_linear_codegen.cpp
  clang/test/OpenMP/parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_for_simd_aligned_codegen.cpp
  clang/test/OpenMP/parallel_if_codegen.cpp
  clang/test/OpenMP/parallel_master_codegen.cpp
  clang/test/OpenMP/parallel_master_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_lastprivate_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/parallel_private_codegen.cpp
  clang/test/OpenMP/parallel_reduction_codegen.cpp
  clang/test/OpenMP/parallel_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_sections_codegen.cpp
  clang/test/OpenMP/parallel_sections_reduction_task_codegen.cpp
  clang/test/OpenMP/reduction_compound_op.cpp
  

[PATCH] D106746: [OpenMPOpt] Expand SPMDization with guarding

2021-07-24 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 361468.
ggeorgakoudis added a comment.

Code cleanup


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106746

Files:
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
  llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
  llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
  llvm/lib/Transforms/IPO/OpenMPOpt.cpp
  openmp/libomptarget/deviceRTLs/common/include/target.h
  openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
  openmp/libomptarget/deviceRTLs/common/src/parallel.cu
  openmp/libomptarget/deviceRTLs/common/support.h
  openmp/libomptarget/deviceRTLs/interface.h

Index: openmp/libomptarget/deviceRTLs/interface.h
===
--- openmp/libomptarget/deviceRTLs/interface.h
+++ openmp/libomptarget/deviceRTLs/interface.h
@@ -417,8 +417,9 @@
 
 // non standard
 EXTERN int32_t __kmpc_target_init(ident_t *Ident, bool IsSPMD,
- bool UseGenericStateMachine,
-   bool RequiresFullRuntime);
+  bool IsSPMDGuarded,
+  bool UseGenericStateMachine,
+  bool RequiresFullRuntime);
 EXTERN void __kmpc_target_deinit(ident_t *Ident, bool IsSPMD,
bool RequiresFullRuntime);
 EXTERN void __kmpc_kernel_prepare_parallel(void *WorkFn);
@@ -449,6 +450,8 @@
 // SPMD execution mode interrogation function.
 EXTERN int8_t __kmpc_is_spmd_exec_mode();
 
+EXTERN int8_t __kmpc_is_spmd_guarded_exec_mode();
+
 /// Return true if the hardware thread id \p Tid represents the OpenMP main
 /// thread in generic mode outside of a parallel region.
 EXTERN int8_t __kmpc_is_generic_main_thread(kmp_int32 Tid);
Index: openmp/libomptarget/deviceRTLs/common/support.h
===
--- openmp/libomptarget/deviceRTLs/common/support.h
+++ openmp/libomptarget/deviceRTLs/common/support.h
@@ -22,13 +22,14 @@
 enum ExecutionMode {
   Spmd = 0x00u,
   Generic = 0x01u,
-  ModeMask = 0x01u,
+  SpmdGuarded = 0x02u,
+  ModeMask = 0x03u,
 };
 
 enum RuntimeMode {
   RuntimeInitialized = 0x00u,
-  RuntimeUninitialized = 0x02u,
-  RuntimeMask = 0x02u,
+  RuntimeUninitialized = 0x04u,
+  RuntimeMask = 0x04u,
 };
 
 void setExecutionParameters(ExecutionMode EMode, RuntimeMode RMode);
Index: openmp/libomptarget/deviceRTLs/common/src/parallel.cu
===
--- openmp/libomptarget/deviceRTLs/common/src/parallel.cu
+++ openmp/libomptarget/deviceRTLs/common/src/parallel.cu
@@ -300,7 +300,36 @@
   }
 
   if (__kmpc_is_spmd_exec_mode()) {
+// Store spmd_guarded status to check after the parallel region executes.
+int is_spmd_guarded = __kmpc_is_spmd_guarded_exec_mode();
+if (is_spmd_guarded) {
+  // No barrier is need on entry since this will be called only from non-guarded
+  // SPMD execution.
+
+  // Disable SPMD guarding for the parallel region. Runtime suport is not needed
+  // by construction of SPMD guarded regions, so simple assignment to Spmd is
+  // enough. Also, a preceding barrier is unnecessary since all threads must be
+  // in non-guarded context when reaching this point.
+  if (__kmpc_get_hardware_thread_id_in_block() == 0)
+execution_param = Spmd;
+
+  // Barrier to ensure all threads are updated to Spmd.
+  __kmpc_barrier_simple_spmd(ident, 0);
+}
+
 __kmp_invoke_microtask(global_tid, 0, fn, args, nargs);
+
+if (is_spmd_guarded) {
+  // Re-enable SPMD guarding. Runtime support is not needed by construction.
+  // Barrier to ensure all threads have finished Spmd execution before
+  // re-enabling guarding.
+  __kmpc_barrier_simple_spmd(ident, 0);
+  if (__kmpc_get_hardware_thread_id_in_block() == 0)
+execution_param = SpmdGuarded;
+
+  // Barrier to ensure all threads are updated to SpmdGuarded.
+  __kmpc_barrier_simple_spmd(ident, 0);
+}
 return;
   }
 
Index: openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
===
--- openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
+++ openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
@@ -82,11 +82,12 @@
   omptarget_nvptx_workFn = 0;
 }
 
-static void __kmpc_spmd_kernel_init(bool RequiresFullRuntime) {
+static void __kmpc_spmd_kernel_init(bool IsSPMDGuarded, bool RequiresFullRuntime) {
   PRINT0(LD_IO, "call to __kmpc_spmd_kernel_init\n");
 
-  setExecutionParameters(Spmd, RequiresFullRuntime ? RuntimeInitialized
- : RuntimeUninitialized);
+  setExecutionParameters(IsSPMDGuarded ? SpmdGuarded : Spmd,
+ RequiresFullRuntime ? RuntimeInitialized
+  

[PATCH] D106746: [OpenMPOpt][WIP] Expand SPMDization with guarding

2021-07-24 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 361456.
ggeorgakoudis added a comment.

Update for sensible access to __kmpc_is_spmd_guarded_exec_mode


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106746

Files:
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
  llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
  llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
  llvm/lib/Transforms/IPO/OpenMPOpt.cpp
  openmp/libomptarget/deviceRTLs/common/include/target.h
  openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
  openmp/libomptarget/deviceRTLs/common/src/parallel.cu
  openmp/libomptarget/deviceRTLs/common/support.h
  openmp/libomptarget/deviceRTLs/interface.h

Index: openmp/libomptarget/deviceRTLs/interface.h
===
--- openmp/libomptarget/deviceRTLs/interface.h
+++ openmp/libomptarget/deviceRTLs/interface.h
@@ -417,8 +417,9 @@
 
 // non standard
 EXTERN int32_t __kmpc_target_init(ident_t *Ident, bool IsSPMD,
- bool UseGenericStateMachine,
-   bool RequiresFullRuntime);
+  bool IsSPMDGuarded,
+  bool UseGenericStateMachine,
+  bool RequiresFullRuntime);
 EXTERN void __kmpc_target_deinit(ident_t *Ident, bool IsSPMD,
bool RequiresFullRuntime);
 EXTERN void __kmpc_kernel_prepare_parallel(void *WorkFn);
@@ -449,6 +450,8 @@
 // SPMD execution mode interrogation function.
 EXTERN int8_t __kmpc_is_spmd_exec_mode();
 
+EXTERN int8_t __kmpc_is_spmd_guarded_exec_mode();
+
 /// Return true if the hardware thread id \p Tid represents the OpenMP main
 /// thread in generic mode outside of a parallel region.
 EXTERN int8_t __kmpc_is_generic_main_thread(kmp_int32 Tid);
Index: openmp/libomptarget/deviceRTLs/common/support.h
===
--- openmp/libomptarget/deviceRTLs/common/support.h
+++ openmp/libomptarget/deviceRTLs/common/support.h
@@ -22,13 +22,14 @@
 enum ExecutionMode {
   Spmd = 0x00u,
   Generic = 0x01u,
-  ModeMask = 0x01u,
+  SpmdGuarded = 0x02u,
+  ModeMask = 0x03u,
 };
 
 enum RuntimeMode {
   RuntimeInitialized = 0x00u,
-  RuntimeUninitialized = 0x02u,
-  RuntimeMask = 0x02u,
+  RuntimeUninitialized = 0x04u,
+  RuntimeMask = 0x04u,
 };
 
 void setExecutionParameters(ExecutionMode EMode, RuntimeMode RMode);
Index: openmp/libomptarget/deviceRTLs/common/src/parallel.cu
===
--- openmp/libomptarget/deviceRTLs/common/src/parallel.cu
+++ openmp/libomptarget/deviceRTLs/common/src/parallel.cu
@@ -300,7 +300,36 @@
   }
 
   if (__kmpc_is_spmd_exec_mode()) {
+// Store spmd_guarded status to check after the parallel region executes.
+int is_spmd_guarded = __kmpc_is_spmd_guarded_exec_mode();
+if (is_spmd_guarded) {
+  // No barrier is need on entry since this will be called only from non-guarded
+  // SPMD execution.
+
+  // Disable SPMD guarding for the parallel region. Runtime suport is not needed
+  // by construction of SPMD guarded regions, so simple assignment to Spmd is
+  // enough. Also, a preceding barrier is unnecessary since all threads must be
+  // in non-guarded context when reaching this point.
+  if (__kmpc_get_hardware_thread_id_in_block() == 0)
+execution_param = Spmd;
+
+  // Barrier to ensure all threads are updated to Spmd.
+  __kmpc_barrier_simple_spmd(ident, 0);
+}
+
 __kmp_invoke_microtask(global_tid, 0, fn, args, nargs);
+
+if (is_spmd_guarded) {
+  // Re-enable SPMD guarding. Runtime support is not needed by construction.
+  // Barrier to ensure all threads have finished Spmd execution before
+  // re-enabling guarding.
+  __kmpc_barrier_simple_spmd(ident, 0);
+  if (__kmpc_get_hardware_thread_id_in_block() == 0)
+execution_param = SpmdGuarded;
+
+  // Barrier to ensure all threads are updated to SpmdGuarded.
+  __kmpc_barrier_simple_spmd(ident, 0);
+}
 return;
   }
 
Index: openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
===
--- openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
+++ openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
@@ -82,11 +82,12 @@
   omptarget_nvptx_workFn = 0;
 }
 
-static void __kmpc_spmd_kernel_init(bool RequiresFullRuntime) {
+static void __kmpc_spmd_kernel_init(bool IsSPMDGuarded, bool RequiresFullRuntime) {
   PRINT0(LD_IO, "call to __kmpc_spmd_kernel_init\n");
 
-  setExecutionParameters(Spmd, RequiresFullRuntime ? RuntimeInitialized
- : RuntimeUninitialized);
+  setExecutionParameters(IsSPMDGuarded ? SpmdGuarded : Spmd,
+ RequiresFullRuntime ? 

[PATCH] D106746: [OpenMPOpt][WIP] Expand SPMDIzation with guarding

2021-07-24 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis created this revision.
Herald added subscribers: ormris, guansong, hiraditya, yaxunl.
ggeorgakoudis requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added a reviewer: jdoerfert.
Herald added a reviewer: sstefan1.
Herald added subscribers: llvm-commits, openmp-commits, cfe-commits, bbn, 
sstefan1.
Herald added a reviewer: baziotis.
Herald added projects: clang, OpenMP, LLVM.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D106746

Files:
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
  llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
  llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
  llvm/lib/Transforms/IPO/OpenMPOpt.cpp
  openmp/libomptarget/deviceRTLs/common/include/target.h
  openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
  openmp/libomptarget/deviceRTLs/common/src/parallel.cu
  openmp/libomptarget/deviceRTLs/common/support.h
  openmp/libomptarget/deviceRTLs/interface.h

Index: openmp/libomptarget/deviceRTLs/interface.h
===
--- openmp/libomptarget/deviceRTLs/interface.h
+++ openmp/libomptarget/deviceRTLs/interface.h
@@ -417,8 +417,9 @@
 
 // non standard
 EXTERN int32_t __kmpc_target_init(ident_t *Ident, bool IsSPMD,
- bool UseGenericStateMachine,
-   bool RequiresFullRuntime);
+  bool IsSPMDGuarded,
+  bool UseGenericStateMachine,
+  bool RequiresFullRuntime);
 EXTERN void __kmpc_target_deinit(ident_t *Ident, bool IsSPMD,
bool RequiresFullRuntime);
 EXTERN void __kmpc_kernel_prepare_parallel(void *WorkFn);
@@ -449,6 +450,8 @@
 // SPMD execution mode interrogation function.
 EXTERN int8_t __kmpc_is_spmd_exec_mode();
 
+EXTERN int8_t __kmpc_is_spmd_guarded_exec_mode();
+
 /// Return true if the hardware thread id \p Tid represents the OpenMP main
 /// thread in generic mode outside of a parallel region.
 EXTERN int8_t __kmpc_is_generic_main_thread(kmp_int32 Tid);
Index: openmp/libomptarget/deviceRTLs/common/support.h
===
--- openmp/libomptarget/deviceRTLs/common/support.h
+++ openmp/libomptarget/deviceRTLs/common/support.h
@@ -22,13 +22,14 @@
 enum ExecutionMode {
   Spmd = 0x00u,
   Generic = 0x01u,
-  ModeMask = 0x01u,
+  SpmdGuarded = 0x02u,
+  ModeMask = 0x03u,
 };
 
 enum RuntimeMode {
   RuntimeInitialized = 0x00u,
-  RuntimeUninitialized = 0x02u,
-  RuntimeMask = 0x02u,
+  RuntimeUninitialized = 0x04u,
+  RuntimeMask = 0x04u,
 };
 
 void setExecutionParameters(ExecutionMode EMode, RuntimeMode RMode);
Index: openmp/libomptarget/deviceRTLs/common/src/parallel.cu
===
--- openmp/libomptarget/deviceRTLs/common/src/parallel.cu
+++ openmp/libomptarget/deviceRTLs/common/src/parallel.cu
@@ -300,7 +300,36 @@
   }
 
   if (__kmpc_is_spmd_exec_mode()) {
+// Store spmd_guarded status to check after the parallel region executes.
+int is_spmd_guarded = __kmpc_is_spmd_guarded_exec_mode();
+if (is_spmd_guarded) {
+  // No barrier is need on entry since this will be called only from non-guarded
+  // SPMD execution.
+
+  // Disable SPMD guarding for the parallel region. Runtime suport is not needed
+  // by construction of SPMD guarded regions, so simple assignment to Spmd is
+  // enough. Also, a preceding barrier is unnecessary since all threads must be
+  // in non-guarded context when reaching this point.
+  if (__kmpc_get_hardware_thread_id_in_block() == 0)
+execution_param = Spmd;
+
+  // Barrier to ensure all threads are updated to Spmd.
+  __kmpc_barrier_simple_spmd(ident, 0);
+}
+
 __kmp_invoke_microtask(global_tid, 0, fn, args, nargs);
+
+if (is_spmd_guarded) {
+  // Re-enable SPMD guarding. Runtime support is not needed by construction.
+  // Barrier to ensure all threads have finished Spmd execution before
+  // re-enabling guarding.
+  __kmpc_barrier_simple_spmd(ident, 0);
+  if (__kmpc_get_hardware_thread_id_in_block() == 0)
+execution_param = SpmdGuarded;
+
+  // Barrier to ensure all threads are updated to SpmdGuarded.
+  __kmpc_barrier_simple_spmd(ident, 0);
+}
 return;
   }
 
Index: openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
===
--- openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
+++ openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
@@ -82,11 +82,12 @@
   omptarget_nvptx_workFn = 0;
 }
 
-static void __kmpc_spmd_kernel_init(bool RequiresFullRuntime) {
+static void __kmpc_spmd_kernel_init(bool IsSPMDGuarded, bool RequiresFullRuntime) {
   PRINT0(LD_IO, "call to __kmpc_spmd_kernel_init\n");
 
-  setExecutionParameters(Spmd, 

[PATCH] D102105: [OpenMP][NFC] Refactor cc tests for implicit simd check

2021-07-21 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis abandoned this revision.
ggeorgakoudis added a comment.

Fixed in another revision (see description)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102105

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


[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2021-07-19 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis added a comment.

Thanks for spotting. Test are auto-gened through update scripts so it should be 
easy to compare. I'll fix and ping.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

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


[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2021-07-17 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe9c7291cb25f: [OpenMP] Codegen aggregate for outlined 
function captures (authored by ggeorgakoudis).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/test/CodeGenCXX/observe-noexcept.cpp
  clang/test/OpenMP/cancel_codegen.cpp
  clang/test/OpenMP/cancellation_point_codegen.cpp
  clang/test/OpenMP/debug-info-complex-byval.cpp
  clang/test/OpenMP/debug-info-openmp-array.cpp
  clang/test/OpenMP/declare_target_codegen_globalization.cpp
  clang/test/OpenMP/distribute_codegen.cpp
  clang/test/OpenMP/distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_codegen.cpp
  clang/test/OpenMP/distribute_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_reduction_codegen.cpp
  clang/test/OpenMP/for_firstprivate_codegen.cpp
  clang/test/OpenMP/for_lastprivate_codegen.cpp
  clang/test/OpenMP/for_linear_codegen.cpp
  clang/test/OpenMP/for_private_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen_UDR.cpp
  clang/test/OpenMP/for_reduction_task_codegen.cpp
  clang/test/OpenMP/master_taskloop_in_reduction_codegen.cpp
  clang/test/OpenMP/master_taskloop_simd_in_reduction_codegen.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/openmp_win_codegen.cpp
  clang/test/OpenMP/parallel_codegen.cpp
  clang/test/OpenMP/parallel_copyin_codegen.cpp
  clang/test/OpenMP/parallel_firstprivate_codegen.cpp
  clang/test/OpenMP/parallel_for_codegen.cpp
  clang/test/OpenMP/parallel_for_lastprivate_conditional.cpp
  clang/test/OpenMP/parallel_for_linear_codegen.cpp
  clang/test/OpenMP/parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_for_simd_aligned_codegen.cpp
  clang/test/OpenMP/parallel_if_codegen.cpp
  clang/test/OpenMP/parallel_master_codegen.cpp
  clang/test/OpenMP/parallel_master_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_lastprivate_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/parallel_private_codegen.cpp
  clang/test/OpenMP/parallel_reduction_codegen.cpp
  clang/test/OpenMP/parallel_reduction_task_codegen.cpp
  

[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2021-07-16 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 359507.
ggeorgakoudis added a comment.
Herald added a subscriber: zzheng.

Rebase, update tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/test/CodeGenCXX/observe-noexcept.cpp
  clang/test/OpenMP/cancel_codegen.cpp
  clang/test/OpenMP/cancellation_point_codegen.cpp
  clang/test/OpenMP/debug-info-complex-byval.cpp
  clang/test/OpenMP/debug-info-openmp-array.cpp
  clang/test/OpenMP/declare_target_codegen_globalization.cpp
  clang/test/OpenMP/distribute_codegen.cpp
  clang/test/OpenMP/distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_codegen.cpp
  clang/test/OpenMP/distribute_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_reduction_codegen.cpp
  clang/test/OpenMP/for_firstprivate_codegen.cpp
  clang/test/OpenMP/for_lastprivate_codegen.cpp
  clang/test/OpenMP/for_linear_codegen.cpp
  clang/test/OpenMP/for_private_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen_UDR.cpp
  clang/test/OpenMP/for_reduction_task_codegen.cpp
  clang/test/OpenMP/master_taskloop_in_reduction_codegen.cpp
  clang/test/OpenMP/master_taskloop_simd_in_reduction_codegen.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/openmp_win_codegen.cpp
  clang/test/OpenMP/parallel_codegen.cpp
  clang/test/OpenMP/parallel_copyin_codegen.cpp
  clang/test/OpenMP/parallel_firstprivate_codegen.cpp
  clang/test/OpenMP/parallel_for_codegen.cpp
  clang/test/OpenMP/parallel_for_lastprivate_conditional.cpp
  clang/test/OpenMP/parallel_for_linear_codegen.cpp
  clang/test/OpenMP/parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_for_simd_aligned_codegen.cpp
  clang/test/OpenMP/parallel_if_codegen.cpp
  clang/test/OpenMP/parallel_master_codegen.cpp
  clang/test/OpenMP/parallel_master_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_lastprivate_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/parallel_private_codegen.cpp
  clang/test/OpenMP/parallel_reduction_codegen.cpp
  clang/test/OpenMP/parallel_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_sections_codegen.cpp
  clang/test/OpenMP/parallel_sections_reduction_task_codegen.cpp
  

[PATCH] D104714: [UpdateCCTestChecks] Support --check-globals

2021-06-23 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis added a comment.

LGMT too!


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

https://reviews.llvm.org/D104714

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


[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2021-06-15 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 352268.
ggeorgakoudis added a comment.

Update non-remark tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/test/CodeGenCXX/observe-noexcept.cpp
  clang/test/OpenMP/cancel_codegen.cpp
  clang/test/OpenMP/cancellation_point_codegen.cpp
  clang/test/OpenMP/debug-info-complex-byval.cpp
  clang/test/OpenMP/debug-info-openmp-array.cpp
  clang/test/OpenMP/declare_target_codegen_globalization.cpp
  clang/test/OpenMP/distribute_codegen.cpp
  clang/test/OpenMP/distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_codegen.cpp
  clang/test/OpenMP/distribute_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_reduction_codegen.cpp
  clang/test/OpenMP/for_firstprivate_codegen.cpp
  clang/test/OpenMP/for_lastprivate_codegen.cpp
  clang/test/OpenMP/for_linear_codegen.cpp
  clang/test/OpenMP/for_private_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen_UDR.cpp
  clang/test/OpenMP/for_reduction_task_codegen.cpp
  clang/test/OpenMP/master_taskloop_in_reduction_codegen.cpp
  clang/test/OpenMP/master_taskloop_simd_in_reduction_codegen.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/openmp_win_codegen.cpp
  clang/test/OpenMP/parallel_codegen.cpp
  clang/test/OpenMP/parallel_copyin_codegen.cpp
  clang/test/OpenMP/parallel_firstprivate_codegen.cpp
  clang/test/OpenMP/parallel_for_codegen.cpp
  clang/test/OpenMP/parallel_for_lastprivate_conditional.cpp
  clang/test/OpenMP/parallel_for_linear_codegen.cpp
  clang/test/OpenMP/parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_if_codegen.cpp
  clang/test/OpenMP/parallel_master_codegen.cpp
  clang/test/OpenMP/parallel_master_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_lastprivate_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/parallel_private_codegen.cpp
  clang/test/OpenMP/parallel_reduction_codegen.cpp
  clang/test/OpenMP/parallel_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_sections_codegen.cpp
  clang/test/OpenMP/parallel_sections_reduction_task_codegen.cpp
  clang/test/OpenMP/reduction_compound_op.cpp
  clang/test/OpenMP/remarks_parallel_in_multiple_target_state_machines.c
  

[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2021-06-15 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis added a comment.

In D102107#2819869 , @lebedev.ri 
wrote:

> (This is not offload-specific, right?)
> This does not bring any compatibility issues, right?

It's not offload-specific, so the patch applies to host OpenMP too. The patch, 
as is, does not introduce any incompatibilities, the OpenMP runtime parallel 
call interface stays the same and the only change is the aggregation of the 
outlined function arguments in a struct. However, it makes sense to simplify 
the OpenMP parallel call runtime interface to avoid variadic arguments. This 
change is not necessary for this patch, but I'm considering to include it too.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

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


[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2021-06-15 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 352178.
ggeorgakoudis added a comment.
Herald added a project: OpenMP.
Herald added a subscriber: openmp-commits.

Rebase to NewGlobalization and amend


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/test/CodeGenCXX/observe-noexcept.cpp
  clang/test/OpenMP/cancel_codegen.cpp
  clang/test/OpenMP/cancellation_point_codegen.cpp
  clang/test/OpenMP/debug-info-complex-byval.cpp
  clang/test/OpenMP/debug-info-openmp-array.cpp
  clang/test/OpenMP/declare_target_codegen_globalization.cpp
  clang/test/OpenMP/distribute_codegen.cpp
  clang/test/OpenMP/distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_codegen.cpp
  clang/test/OpenMP/distribute_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_reduction_codegen.cpp
  clang/test/OpenMP/for_firstprivate_codegen.cpp
  clang/test/OpenMP/for_lastprivate_codegen.cpp
  clang/test/OpenMP/for_linear_codegen.cpp
  clang/test/OpenMP/for_private_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen_UDR.cpp
  clang/test/OpenMP/for_reduction_task_codegen.cpp
  clang/test/OpenMP/master_taskloop_in_reduction_codegen.cpp
  clang/test/OpenMP/master_taskloop_simd_in_reduction_codegen.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/openmp_win_codegen.cpp
  clang/test/OpenMP/parallel_codegen.cpp
  clang/test/OpenMP/parallel_copyin_codegen.cpp
  clang/test/OpenMP/parallel_firstprivate_codegen.cpp
  clang/test/OpenMP/parallel_for_codegen.cpp
  clang/test/OpenMP/parallel_for_lastprivate_conditional.cpp
  clang/test/OpenMP/parallel_for_linear_codegen.cpp
  clang/test/OpenMP/parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_if_codegen.cpp
  clang/test/OpenMP/parallel_master_codegen.cpp
  clang/test/OpenMP/parallel_master_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_lastprivate_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/parallel_private_codegen.cpp
  clang/test/OpenMP/parallel_reduction_codegen.cpp
  clang/test/OpenMP/parallel_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_sections_codegen.cpp
  clang/test/OpenMP/parallel_sections_reduction_task_codegen.cpp
  

[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2021-05-24 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis added a comment.

In D102107#2776237 , @jdoerfert wrote:

> This allows us to remove the switch in the device runtime, right?

Yes, with a complication: for combined directives of worksharing loops 
(distributed parallel for) clang emits the lower bound and upper bound as 
distinct parameters besides the global tid, bound tid and the captured 
variables (aggregated in the struct of this patch). We will need to have a flag 
in parallel_51 to unwrap the global args array for this case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

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


[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2021-05-22 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 347230.
ggeorgakoudis added a comment.

Use non-aggregate captured args and outlining for ordered codegen


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/test/CodeGenCXX/observe-noexcept.cpp
  clang/test/OpenMP/cancel_codegen.cpp
  clang/test/OpenMP/cancellation_point_codegen.cpp
  clang/test/OpenMP/debug-info-complex-byval.cpp
  clang/test/OpenMP/debug-info-openmp-array.cpp
  clang/test/OpenMP/declare_target_codegen_globalization.cpp
  clang/test/OpenMP/distribute_codegen.cpp
  clang/test/OpenMP/distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_codegen.cpp
  clang/test/OpenMP/distribute_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_reduction_codegen.cpp
  clang/test/OpenMP/for_firstprivate_codegen.cpp
  clang/test/OpenMP/for_lastprivate_codegen.cpp
  clang/test/OpenMP/for_linear_codegen.cpp
  clang/test/OpenMP/for_private_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen_UDR.cpp
  clang/test/OpenMP/for_reduction_task_codegen.cpp
  clang/test/OpenMP/master_taskloop_in_reduction_codegen.cpp
  clang/test/OpenMP/master_taskloop_simd_in_reduction_codegen.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/openmp_win_codegen.cpp
  clang/test/OpenMP/parallel_codegen.cpp
  clang/test/OpenMP/parallel_copyin_codegen.cpp
  clang/test/OpenMP/parallel_firstprivate_codegen.cpp
  clang/test/OpenMP/parallel_for_codegen.cpp
  clang/test/OpenMP/parallel_for_lastprivate_conditional.cpp
  clang/test/OpenMP/parallel_for_linear_codegen.cpp
  clang/test/OpenMP/parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_if_codegen.cpp
  clang/test/OpenMP/parallel_master_codegen.cpp
  clang/test/OpenMP/parallel_master_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_lastprivate_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/parallel_private_codegen.cpp
  clang/test/OpenMP/parallel_reduction_codegen.cpp
  clang/test/OpenMP/parallel_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_sections_codegen.cpp
  clang/test/OpenMP/parallel_sections_reduction_task_codegen.cpp
  clang/test/OpenMP/reduction_compound_op.cpp
  

[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2021-05-22 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 347206.
ggeorgakoudis added a comment.
Herald added a subscriber: jfb.

Add tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/test/CodeGenCXX/observe-noexcept.cpp
  clang/test/OpenMP/cancel_codegen.cpp
  clang/test/OpenMP/cancellation_point_codegen.cpp
  clang/test/OpenMP/debug-info-complex-byval.cpp
  clang/test/OpenMP/debug-info-openmp-array.cpp
  clang/test/OpenMP/declare_target_codegen_globalization.cpp
  clang/test/OpenMP/distribute_codegen.cpp
  clang/test/OpenMP/distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_codegen.cpp
  clang/test/OpenMP/distribute_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_reduction_codegen.cpp
  clang/test/OpenMP/for_firstprivate_codegen.cpp
  clang/test/OpenMP/for_lastprivate_codegen.cpp
  clang/test/OpenMP/for_linear_codegen.cpp
  clang/test/OpenMP/for_private_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen_UDR.cpp
  clang/test/OpenMP/for_reduction_task_codegen.cpp
  clang/test/OpenMP/master_taskloop_in_reduction_codegen.cpp
  clang/test/OpenMP/master_taskloop_simd_in_reduction_codegen.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/openmp_win_codegen.cpp
  clang/test/OpenMP/ordered_codegen.cpp
  clang/test/OpenMP/parallel_codegen.cpp
  clang/test/OpenMP/parallel_copyin_codegen.cpp
  clang/test/OpenMP/parallel_firstprivate_codegen.cpp
  clang/test/OpenMP/parallel_for_codegen.cpp
  clang/test/OpenMP/parallel_for_lastprivate_conditional.cpp
  clang/test/OpenMP/parallel_for_linear_codegen.cpp
  clang/test/OpenMP/parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_if_codegen.cpp
  clang/test/OpenMP/parallel_master_codegen.cpp
  clang/test/OpenMP/parallel_master_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_lastprivate_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/parallel_private_codegen.cpp
  clang/test/OpenMP/parallel_reduction_codegen.cpp
  clang/test/OpenMP/parallel_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_sections_codegen.cpp
  clang/test/OpenMP/parallel_sections_reduction_task_codegen.cpp
  clang/test/OpenMP/reduction_compound_op.cpp
  

[PATCH] D102105: [OpenMP][NFC] Refactor cc tests for implicit simd check

2021-05-18 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 346255.
ggeorgakoudis added a comment.

Update for correct implicit checks


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102105

Files:
  clang/test/OpenMP/cancel_codegen.cpp
  clang/test/OpenMP/cancellation_point_codegen.cpp
  clang/test/OpenMP/debug-info-complex-byval.cpp
  clang/test/OpenMP/debug-info-openmp-array.cpp
  clang/test/OpenMP/distribute_codegen.cpp
  clang/test/OpenMP/distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/distribute_private_codegen.cpp
  clang/test/OpenMP/for_firstprivate_codegen.cpp
  clang/test/OpenMP/for_lastprivate_codegen.cpp
  clang/test/OpenMP/for_linear_codegen.cpp
  clang/test/OpenMP/for_private_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen.cpp
  clang/test/OpenMP/for_reduction_task_codegen.cpp
  clang/test/OpenMP/master_taskloop_in_reduction_codegen.cpp
  clang/test/OpenMP/openmp_win_codegen.cpp
  clang/test/OpenMP/parallel_codegen.cpp
  clang/test/OpenMP/parallel_copyin_codegen.cpp
  clang/test/OpenMP/parallel_firstprivate_codegen.cpp
  clang/test/OpenMP/parallel_for_codegen.cpp
  clang/test/OpenMP/parallel_for_lastprivate_conditional.cpp
  clang/test/OpenMP/parallel_for_linear_codegen.cpp
  clang/test/OpenMP/parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_if_codegen.cpp
  clang/test/OpenMP/parallel_master_codegen.cpp
  clang/test/OpenMP/parallel_master_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_lastprivate_codegen.cpp
  clang/test/OpenMP/parallel_private_codegen.cpp
  clang/test/OpenMP/parallel_reduction_codegen.cpp
  clang/test/OpenMP/parallel_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_sections_codegen.cpp
  clang/test/OpenMP/parallel_sections_reduction_task_codegen.cpp
  clang/test/OpenMP/sections_firstprivate_codegen.cpp
  clang/test/OpenMP/sections_lastprivate_codegen.cpp
  clang/test/OpenMP/sections_private_codegen.cpp
  clang/test/OpenMP/sections_reduction_codegen.cpp
  clang/test/OpenMP/sections_reduction_task_codegen.cpp
  clang/test/OpenMP/single_codegen.cpp
  clang/test/OpenMP/single_firstprivate_codegen.cpp
  clang/test/OpenMP/single_private_codegen.cpp
  clang/test/OpenMP/target_codegen_global_capture.cpp
  clang/test/OpenMP/target_map_codegen_03.cpp
  clang/test/OpenMP/target_parallel_codegen.cpp
  clang/test/OpenMP/target_parallel_for_codegen.cpp
  clang/test/OpenMP/target_parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/target_parallel_if_codegen.cpp
  clang/test/OpenMP/target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/target_parallel_reduction_task_codegen.cpp
  clang/test/OpenMP/target_teams_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_collapse_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_dist_schedule_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_collapse_codegen.cpp
  
clang/test/OpenMP/target_teams_distribute_parallel_for_dist_schedule_codegen.cpp
  
clang/test/OpenMP/target_teams_distribute_parallel_for_firstprivate_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_lastprivate_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_order_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_private_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_proc_bind_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_reduction_codegen.cpp
  
clang/test/OpenMP/target_teams_distribute_parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_schedule_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_private_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_reduction_codegen.cpp
  clang/test/OpenMP/target_teams_num_teams_codegen.cpp
  clang/test/OpenMP/target_teams_thread_limit_codegen.cpp
  clang/test/OpenMP/task_codegen.cpp
  clang/test/OpenMP/task_if_codegen.cpp
  

[PATCH] D101849: [OpenMP][NFC] Refactor Clang OpenMP tests using update_cc_test_checks

2021-05-18 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis added a comment.

In D101849#2766411 , @mikerice wrote:

> In D101849#2764825 , @ABataev wrote:
>
>> No, it is not required. Most probably, needed to simplify test checks, 
>> nothing else.
>
> Thanks.  I'd like to remove the "REQUIRES: x86-registered-target", the -O1 
> for CHECK6,10, and regenerate the CHECK lines.  Unfortunately I am seeing 
> this mangling issue (https://bugs.llvm.org/show_bug.cgi?id=49767) when 
> running the script. @ggeorgakoudis, how did you get past this to generate the 
> CHECK lines in your change?

I built without asserts :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101849

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


[PATCH] D101974: [Utils][WIP] Refactor script for cc tests

2021-05-18 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 346235.
ggeorgakoudis added a comment.

Update correction for implicit simd checks


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101974

Files:
  clang/utils/refactor_cc_tests.py

Index: clang/utils/refactor_cc_tests.py
===
--- /dev/null
+++ clang/utils/refactor_cc_tests.py
@@ -0,0 +1,136 @@
+#!/usr/bin/env python3
+
+import argparse
+import re
+import subprocess
+import sys
+import multiprocessing
+from itertools import repeat
+from itertools import starmap
+
+def run_update_cc(filename, llvm_util_dir, llvm_bin):
+# Probably we don't need to those arguments since we added a NOTE line.
+update_cc = [ llvm_util_dir + '/update_cc_test_checks.py', '--llvm-bin', llvm_bin,
+'--include-generated-func',
+'--function-signature',
+'--replace-value-regex', '\"__omp_offloading_[0-9a-z]+_[0-9a-z]+\"',
+'\"reduction_size[.].+[.]\"',
+'\"pl_cond[.].+[.|,]\"',
+'--prefix-filecheck-ir-name', '_',
+filename]
+
+# Run update_cc_test_checks.py.
+print('Running update_cc')
+popen = subprocess.Popen(update_cc, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
+stdout, stderr = popen.communicate()
+if popen.returncode != 0:
+sys.stderr.write('Failed to run update_cc '+ ' '.join(update_cc) + '\n')
+sys.stderr.write(stderr)
+sys.stderr.write(stdout)
+return popen.returncode
+
+return popen.returncode
+
+def refactor(filename, llvm_util_dir, llvm_bin):
+print('Processing file ', filename, '...')
+with open(filename, 'r') as f:
+input_lines = f.readlines()
+output_lines = ''
+cnt = 1
+check_prefix_set = {'CHECK'}
+for line in input_lines:
+# Modify run line.
+if line.startswith('// RUN'):
+# Process FileCheck in line.
+if 'FileCheck' in line:
+m = re.findall(r'--?check-prefix(?:es)?(?:\s|=)(.+?)\s+', line)
+# Extract check prefixes to remove check lines.
+check_prefix_list = []
+for i in m:
+check_prefix_list += i.split(',')
+check_prefix_set.update(set(check_prefix_list))
+# Delete all check prefixes.
+if m:
+line = re.sub(r'(?:-|--)check-prefix(?:es|)(?:\s|=).+?\s+', r'', line)
+
+# Generate implicit check.
+if '-fopenmp-simd' in line and \
+not re.search(r'\b-fopenmp\b', line) and \
+not re.search(r' simd', ''.join(input_lines)):
+if not re.search(r'--implicit-check-not="{{__kmpc|__tgt}}"', line):
+line = line[:-1] + \
+' --implicit-check-not="{{__kmpc|__tgt}}"\n'
+# Generate check prefix using the counter.
+else:
+line = line[:-1] + ' --check-prefix=CHECK%d\n'%(cnt)
+cnt += 1
+
+# Replace generic triple.
+# TODO: add ms_abi_triple
+if '%itanium_abi_triple' in line:
+line = re.sub(r'%itanium_abi_triple', 'x86_64-unknown-linux', line)
+
+if 'clang' in line and not '-triple' in line:
+line = re.sub(r'clang(_cc1|xx)?\s+', r'clang\g<1> -triple x86_64-unknown-linux ', line)
+output_lines += line
+elif line.startswith('// NOTE:'):
+# Skip NOTE line, script will add its own.
+continue
+else:
+check_prefix_regex = '(' + '|'.join(check_prefix_set) + ')'
+# Discard check line.
+if re.match(r'\s*//\s*%s'%(check_prefix_regex), line):
+continue
+
+# Skip empty comment lines to match update_cc handling.
+line_strip = line.strip()
+if line_strip == '//':
+pass
+# Keep line.
+else:
+output_lines += line
+# Add NOTE to avoid omp_offloading line number problems
+NOTE = ('// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py'
+' UTC_ARGS: --function-signature --include-generated-funcs'
+' --replace-value-regex "__omp_offloading_[0-9a-z]+_[0-9a-z]+" "reduction_size[.].+[.]" "pl_cond[.].+[.|,]"'
+' --prefix-filecheck-ir-name _\n')
+output_lines = NOTE + output_lines
+
+with open(filename, 'w') as f:
+f.write(output_lines)
+
+# Run update_cc_test_checks.py.
+ret = run_update_cc(filename, llvm_util_dir, llvm_bin)
+if ret == 0:
+  

[PATCH] D102558: [Utils] Check for generated functions inline if possible

2021-05-17 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis added inline comments.



Comment at: 
clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.generated.expected:100
+  }
+}

The checks for the outlined function are missing?



Comment at: 
clang/test/utils/update_cc_test_checks/Inputs/lots-of-generated-funcs.c.lots-of-generated.expected:8
+// OMP-NEXT:  entry:
+// OMP-NEXT:call void (%struct.ident_t*, i32, void (i32*, i32*, ...)*, 
...) @__kmpc_fork_call(%struct.ident_t* @[[GLOB1:[0-9]+]], i32 0, void (i32*, 
i32*, ...)* bitcast (void (i32*, i32*)* @.omp_outlined. to void (i32*, i32*, 
...)*))
+// OMP-NEXT:call void (%struct.ident_t*, i32, void (i32*, i32*, ...)*, 
...) @__kmpc_fork_call(%struct.ident_t* @[[GLOB1]], i32 0, void (i32*, i32*, 
...)* bitcast (void (i32*, i32*)* @.omp_outlined..1 to void (i32*, i32*, ...)*))

Checks for .ompu_outlined. are missing



Comment at: 
clang/test/utils/update_cc_test_checks/Inputs/lots-of-generated-funcs.c.lots-of-generated.expected:47
+// OMP-NEXT:  entry:
+// OMP-NEXT:call void (%struct.ident_t*, i32, void (i32*, i32*, ...)*, 
...) @__kmpc_fork_call(%struct.ident_t* @[[GLOB1]], i32 0, void (i32*, i32*, 
...)* bitcast (void (i32*, i32*)* @.omp_outlined..3 to void (i32*, i32*, ...)*))
+// OMP-NEXT:call void (%struct.ident_t*, i32, void (i32*, i32*, ...)*, 
...) @__kmpc_fork_call(%struct.ident_t* @[[GLOB1]], i32 0, void (i32*, i32*, 
...)* bitcast (void (i32*, i32*)* @.omp_outlined..4 to void (i32*, i32*, ...)*))

Checks for .omp_outlined..3 are missing



Comment at: 
clang/test/utils/update_cc_test_checks/Inputs/lots-of-generated-funcs.c.lots-of-generated.expected:86
+// OMP-NEXT:  entry:
+// OMP-NEXT:call void (%struct.ident_t*, i32, void (i32*, i32*, ...)*, 
...) @__kmpc_fork_call(%struct.ident_t* @[[GLOB1]], i32 0, void (i32*, i32*, 
...)* bitcast (void (i32*, i32*)* @.omp_outlined..6 to void (i32*, i32*, ...)*))
+// OMP-NEXT:call void (%struct.ident_t*, i32, void (i32*, i32*, ...)*, 
...) @__kmpc_fork_call(%struct.ident_t* @[[GLOB1]], i32 0, void (i32*, i32*, 
...)* bitcast (void (i32*, i32*)* @.omp_outlined..7 to void (i32*, i32*, ...)*))

Checks for .omp_outlined..6 are missing


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102558

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


[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2021-05-08 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis created this revision.
Herald added subscribers: guansong, yaxunl.
ggeorgakoudis requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: cfe-commits, sstefan1.
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D102107

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/lib/CodeGen/CodeGenFunction.h

Index: clang/lib/CodeGen/CodeGenFunction.h
===
--- clang/lib/CodeGen/CodeGenFunction.h
+++ clang/lib/CodeGen/CodeGenFunction.h
@@ -3276,8 +3276,13 @@
   llvm::Function *EmitCapturedStmt(const CapturedStmt , CapturedRegionKind K);
   llvm::Function *GenerateCapturedStmtFunction(const CapturedStmt );
   Address GenerateCapturedStmtArgument(const CapturedStmt );
+  llvm::Function *
+  GenerateOpenMPCapturedStmtFunctionAggregate(const CapturedStmt ,
+  SourceLocation Loc);
   llvm::Function *GenerateOpenMPCapturedStmtFunction(const CapturedStmt ,
  SourceLocation Loc);
+  void GenerateOpenMPCapturedVarsAggregate(
+  const CapturedStmt , SmallVectorImpl );
   void GenerateOpenMPCapturedVars(const CapturedStmt ,
   SmallVectorImpl );
   void emitOMPSimpleStore(LValue LVal, RValue RVal, QualType RValTy,
Index: clang/lib/CodeGen/CGStmtOpenMP.cpp
===
--- clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -318,6 +318,32 @@
   return CGM.getSize(SizeInChars);
 }
 
+void CodeGenFunction::GenerateOpenMPCapturedVarsAggregate(
+const CapturedStmt , SmallVectorImpl ) {
+  const RecordDecl *RD = S.getCapturedRecordDecl();
+  QualType RecordTy = getContext().getRecordType(RD);
+  // Create the aggregate argument struct for the outlined function.
+  LValue AggLV = MakeAddrLValue(
+  CreateMemTemp(RecordTy, "omp.outlined.arg.agg."), RecordTy);
+
+  // Initialize the aggregate with captured values.
+  auto CurField = RD->field_begin();
+  for (CapturedStmt::const_capture_init_iterator I = S.capture_init_begin(),
+ E = S.capture_init_end();
+   I != E; ++I, ++CurField) {
+LValue LV = EmitLValueForFieldInitialization(AggLV, *CurField);
+// Initialize for VLA.
+if (CurField->hasCapturedVLAType()) {
+  EmitLambdaVLACapture(CurField->getCapturedVLAType(), LV);
+} else
+  // Initialize for capturesThis, capturesVariableByCopy,
+  // capturesVariable
+  EmitInitializerForField(*CurField, LV, *I);
+  }
+
+  CapturedVars.push_back(AggLV.getPointer(*this));
+}
+
 void CodeGenFunction::GenerateOpenMPCapturedVars(
 const CapturedStmt , SmallVectorImpl ) {
   const RecordDecl *RD = S.getCapturedRecordDecl();
@@ -418,6 +444,101 @@
 };
 } // namespace
 
+static llvm::Function *emitOutlinedFunctionPrologueAggregate(
+CodeGenFunction , FunctionArgList ,
+llvm::MapVector>
+,
+llvm::DenseMap>
+,
+llvm::Value *, const CapturedStmt , SourceLocation Loc,
+StringRef FunctionName) {
+  const CapturedDecl *CD = CS.getCapturedDecl();
+  const RecordDecl *RD = CS.getCapturedRecordDecl();
+  assert(CD->hasBody() && "missing CapturedDecl body");
+
+  CXXThisValue = nullptr;
+  // Build the argument list.
+  CodeGenModule  = CGF.CGM;
+  ASTContext  = CGM.getContext();
+  Args.append(CD->param_begin(), CD->param_end());
+
+  // Create the function declaration.
+  const CGFunctionInfo  =
+  CGM.getTypes().arrangeBuiltinFunctionDeclaration(Ctx.VoidTy, Args);
+  llvm::FunctionType *FuncLLVMTy = CGM.getTypes().GetFunctionType(FuncInfo);
+
+  auto *F =
+  llvm::Function::Create(FuncLLVMTy, llvm::GlobalValue::InternalLinkage,
+ FunctionName, ());
+  CGM.SetInternalFunctionAttributes(CD, F, FuncInfo);
+  if (CD->isNothrow())
+F->setDoesNotThrow();
+  F->setDoesNotRecurse();
+
+  // Generate the function.
+  CGF.StartFunction(CD, Ctx.VoidTy, F, FuncInfo, Args, Loc, Loc);
+  Address ContextAddr = CGF.GetAddrOfLocalVar(CD->getContextParam());
+  llvm::Value *ContextV = CGF.Builder.CreateLoad(ContextAddr);
+  LValue ContextLV = CGF.MakeNaturalAlignAddrLValue(
+  ContextV, CGM.getContext().getTagDeclType(RD));
+  auto I = CS.captures().begin();
+  for (const FieldDecl *FD : RD->fields()) {
+LValue FieldLV = CGF.EmitLValueForFieldInitialization(ContextLV, FD);
+// Do not map arguments if we emit function with non-original types.
+Address LocalAddr = FieldLV.getAddress(CGF);
+// If we are capturing a pointer by copy we don't need to do anything, just
+// use the value that we get from the arguments.
+if (I->capturesVariableByCopy() && FD->getType()->isAnyPointerType()) {
+  const VarDecl *CurVD = 

[PATCH] D102105: [OpenMP][NFC] Refactor cc tests for implicit simd check

2021-05-08 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis created this revision.
Herald added subscribers: jfb, guansong, yaxunl.
ggeorgakoudis requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: cfe-commits, sstefan1.
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D102105

Files:
  clang/test/OpenMP/cancel_codegen.cpp
  clang/test/OpenMP/cancellation_point_codegen.cpp
  clang/test/OpenMP/debug-info-complex-byval.cpp
  clang/test/OpenMP/debug-info-openmp-array.cpp
  clang/test/OpenMP/distribute_codegen.cpp
  clang/test/OpenMP/distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_codegen.cpp
  clang/test/OpenMP/distribute_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_reduction_codegen.cpp
  clang/test/OpenMP/for_firstprivate_codegen.cpp
  clang/test/OpenMP/for_lastprivate_codegen.cpp
  clang/test/OpenMP/for_linear_codegen.cpp
  clang/test/OpenMP/for_private_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen_UDR.cpp
  clang/test/OpenMP/for_reduction_task_codegen.cpp
  clang/test/OpenMP/master_taskloop_in_reduction_codegen.cpp
  clang/test/OpenMP/master_taskloop_simd_in_reduction_codegen.cpp
  clang/test/OpenMP/openmp_win_codegen.cpp
  clang/test/OpenMP/ordered_codegen.cpp
  clang/test/OpenMP/parallel_codegen.cpp
  clang/test/OpenMP/parallel_copyin_codegen.cpp
  clang/test/OpenMP/parallel_firstprivate_codegen.cpp
  clang/test/OpenMP/parallel_for_codegen.cpp
  clang/test/OpenMP/parallel_for_lastprivate_conditional.cpp
  clang/test/OpenMP/parallel_for_linear_codegen.cpp
  clang/test/OpenMP/parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_if_codegen.cpp
  clang/test/OpenMP/parallel_master_codegen.cpp
  clang/test/OpenMP/parallel_master_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_lastprivate_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/parallel_private_codegen.cpp
  clang/test/OpenMP/parallel_reduction_codegen.cpp
  clang/test/OpenMP/parallel_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_sections_codegen.cpp
  clang/test/OpenMP/parallel_sections_reduction_task_codegen.cpp
  clang/test/OpenMP/sections_firstprivate_codegen.cpp
  clang/test/OpenMP/sections_lastprivate_codegen.cpp
  clang/test/OpenMP/sections_private_codegen.cpp
  clang/test/OpenMP/sections_reduction_codegen.cpp
  clang/test/OpenMP/sections_reduction_task_codegen.cpp
  clang/test/OpenMP/single_codegen.cpp
  clang/test/OpenMP/single_firstprivate_codegen.cpp
  clang/test/OpenMP/single_private_codegen.cpp
  clang/test/OpenMP/target_codegen_global_capture.cpp
  clang/test/OpenMP/target_map_codegen_03.cpp
  clang/test/OpenMP/target_parallel_codegen.cpp
  clang/test/OpenMP/target_parallel_for_codegen.cpp
  clang/test/OpenMP/target_parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/target_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/target_parallel_if_codegen.cpp
  clang/test/OpenMP/target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/target_parallel_reduction_task_codegen.cpp
  clang/test/OpenMP/target_teams_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_collapse_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_dist_schedule_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_codegen.cpp
  

[PATCH] D101974: [Utils][WIP] Refactor script for cc tests

2021-05-08 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 343839.
ggeorgakoudis added a comment.

Update fopenmp-simd handling to avoid duplicate implicit checks


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101974

Files:
  clang/utils/refactor_cc_tests.py

Index: clang/utils/refactor_cc_tests.py
===
--- /dev/null
+++ clang/utils/refactor_cc_tests.py
@@ -0,0 +1,135 @@
+#!/usr/bin/env python3
+
+import argparse
+import re
+import subprocess
+import sys
+import multiprocessing
+from itertools import repeat
+from itertools import starmap
+
+def run_update_cc(filename, llvm_util_dir, llvm_bin):
+# Probably we don't need to those arguments since we added a NOTE line.
+update_cc = [ llvm_util_dir + '/update_cc_test_checks.py', '--llvm-bin', llvm_bin,
+'--include-generated-func',
+'--function-signature',
+'--replace-value-regex', '\"__omp_offloading_[0-9a-z]+_[0-9a-z]+\"',
+'\"reduction_size[.].+[.]\"',
+'\"pl_cond[.].+[.|,]\"',
+'--prefix-filecheck-ir-name', '_',
+filename]
+
+# Run update_cc_test_checks.py.
+print('Running update_cc')
+popen = subprocess.Popen(update_cc, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
+stdout, stderr = popen.communicate()
+if popen.returncode != 0:
+sys.stderr.write('Failed to run update_cc '+ ' '.join(update_cc) + '\n')
+sys.stderr.write(stderr)
+sys.stderr.write(stdout)
+return popen.returncode
+
+return popen.returncode
+
+def refactor(filename, llvm_util_dir, llvm_bin):
+input_lines = ''
+print('Processing file ', filename, '...')
+with open(filename, 'r') as f:
+output_lines = ''
+cnt = 1
+check_prefix_set = {'CHECK'}
+for line in f:
+input_lines += line
+# Modify run line.
+if line.startswith('// RUN'):
+# Process FileCheck in line.
+if 'FileCheck' in line:
+m = re.findall(r'--?check-prefix(?:es)?(?:\s|=)(.+?)\s+', line)
+# Extract check prefixes to remove check lines.
+check_prefix_list = []
+for i in m:
+check_prefix_list += i.split(',')
+check_prefix_set.update(set(check_prefix_list))
+# Delete all check prefixes.
+if m:
+line = re.sub(r'(?:-|--)check-prefix(?:es|)(?:\s|=).+?\s+', r'', line)
+
+# Generate implicit check.
+if '-fopenmp-simd' in line and not re.search(r'\b-fopenmp\b', line):
+if not re.search(r'--implicit-check-not="{{__kmpc|__tgt}}"', line):
+line = line[:-1] + \
+' --implicit-check-not="{{__kmpc|__tgt}}"\n'
+# Generate check prefix using the counter.
+else:
+line = line[:-1] + ' --check-prefix=CHECK%d\n'%(cnt)
+cnt += 1
+
+# Replace generic triple.
+# TODO: add ms_abi_triple
+if '%itanium_abi_triple' in line:
+line = re.sub(r'%itanium_abi_triple', 'x86_64-unknown-linux', line)
+
+if 'clang' in line and not '-triple' in line:
+line = re.sub(r'clang(_cc1|xx)?\s+', r'clang\g<1> -triple x86_64-unknown-linux ', line)
+output_lines += line
+elif line.startswith('// NOTE:'):
+# Skip NOTE line, script will add its own.
+continue
+else:
+check_prefix_regex = '(' + '|'.join(check_prefix_set) + ')'
+# Discard check line.
+if re.match(r'\s*//\s*%s'%(check_prefix_regex), line):
+continue
+
+# Skip empty comment lines to match update_cc handling.
+line_strip = line.strip()
+if line_strip == '//':
+pass
+# Keep line.
+else:
+output_lines += line
+# Add NOTE to avoid omp_offloading line number problems
+NOTE = ('// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py'
+' UTC_ARGS: --function-signature --include-generated-funcs'
+' --replace-value-regex "__omp_offloading_[0-9a-z]+_[0-9a-z]+" "reduction_size[.].+[.]" "pl_cond[.].+[.|,]"'
+' --prefix-filecheck-ir-name _\n')
+output_lines = NOTE + output_lines
+
+with open(filename, 'w') as f:
+f.write(output_lines)
+
+# Run update_cc_test_checks.py.
+ret = run_update_cc(filename, llvm_util_dir, llvm_bin)
+if ret == 0:
+# Done, return 1.
+return 1
+else:
+with 

[PATCH] D101974: [Utils][WIP] Refactor script for cc tests

2021-05-06 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 343438.
ggeorgakoudis added a comment.

Update regex for removing old checklines


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101974

Files:
  clang/utils/refactor_cc_tests.py

Index: clang/utils/refactor_cc_tests.py
===
--- /dev/null
+++ clang/utils/refactor_cc_tests.py
@@ -0,0 +1,133 @@
+#!/usr/bin/env python3
+
+import argparse
+import re
+import subprocess
+import sys
+import multiprocessing
+from itertools import repeat
+from itertools import starmap
+
+def run_update_cc(filename, llvm_util_dir, llvm_bin):
+# Probably we don't need to those arguments since we added a NOTE line.
+update_cc = [ llvm_util_dir + '/update_cc_test_checks.py', '--llvm-bin', llvm_bin,
+'--include-generated-func',
+'--function-signature',
+'--replace-value-regex', '\"__omp_offloading_[0-9a-z]+_[0-9a-z]+\"',
+'\"reduction_size[.].+[.]\"',
+'\"pl_cond[.].+[.|,]\"',
+'--prefix-filecheck-ir-name', '_',
+filename]
+
+# Run update_cc_test_checks.py.
+print('Running update_cc')
+popen = subprocess.Popen(update_cc, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
+stdout, stderr = popen.communicate()
+if popen.returncode != 0:
+sys.stderr.write('Failed to run update_cc '+ ' '.join(update_cc) + '\n')
+sys.stderr.write(stderr)
+sys.stderr.write(stdout)
+return popen.returncode
+
+return popen.returncode
+
+def refactor(filename, llvm_util_dir, llvm_bin):
+input_lines = ''
+print('Processing file ', filename, '...')
+with open(filename, 'r') as f:
+output_lines = ''
+cnt = 1
+check_prefix_set = {'CHECK'}
+for line in f:
+input_lines += line
+# Modify run line.
+if line.startswith('// RUN'):
+# Process FileCheck in line.
+if 'FileCheck' in line:
+m = re.findall(r'--?check-prefix(?:es)?(?:\s|=)(.+?)\s+', line)
+# Extract check prefixes to remove check lines.
+check_prefix_list = []
+for i in m:
+check_prefix_list += i.split(',')
+check_prefix_set.update(set(check_prefix_list))
+# Delete all check prefixes.
+if m:
+line = re.sub(r'(?:-|--)check-prefix(?:es|)(?:\s|=).+?\s+', r'', line)
+
+# Generate implicit check.
+if '-fopenmp-simd' in line and not re.search(r'\b-fopenmp\b', line):
+line = line[:-1] + ' --implicit-check-not="{{__kmpc|__tgt}}"\n'
+# Generate check prefix using the counter.
+else:
+line = line[:-1] + ' --check-prefix=CHECK%d\n'%(cnt)
+cnt += 1
+
+# Replace generic triple.
+# TODO: add ms_abi_triple
+if '%itanium_abi_triple' in line:
+line = re.sub(r'%itanium_abi_triple', 'x86_64-unknown-linux', line)
+
+if 'clang' in line and not '-triple' in line:
+line = re.sub(r'clang(_cc1|xx)?\s+', r'clang\g<1> -triple x86_64-unknown-linux ', line)
+output_lines += line
+elif line.startswith('// NOTE:'):
+# Skip NOTE line, script will add its own.
+continue
+else:
+check_prefix_regex = '(' + '|'.join(check_prefix_set) + ')'
+# Discard check line.
+if re.match(r'\s*//\s*%s'%(check_prefix_regex), line):
+continue
+
+# Skip empty comment lines to match update_cc handling.
+line_strip = line.strip()
+if line_strip == '//':
+pass
+# Keep line.
+else:
+output_lines += line
+# Add NOTE to avoid omp_offloading line number problems
+NOTE = ('// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py'
+' UTC_ARGS: --function-signature --include-generated-funcs'
+' --replace-value-regex "__omp_offloading_[0-9a-z]+_[0-9a-z]+" "reduction_size[.].+[.]" "pl_cond[.].+[.|,]"'
+' --prefix-filecheck-ir-name _\n')
+output_lines = NOTE + output_lines
+
+with open(filename, 'w') as f:
+f.write(output_lines)
+
+# Run update_cc_test_checks.py.
+ret = run_update_cc(filename, llvm_util_dir, llvm_bin)
+if ret == 0:
+# Done, return 1.
+return 1
+else:
+with open(filename, 'w') as f:
+  f.write(input_lines)
+# Failed, return 0.
+return 0
+
+def main():
+parser = 

[PATCH] D101849: [OpenMP][NFC] Refactor Clang OpenMP tests using update_cc_test_checks

2021-05-06 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis added a comment.

In D101849#2741980 , @DavidSpickett 
wrote:

> I've required X86 target for this test to get our bots green again.

Thanks David for the workaround. I agree with Johannes's comments below. It 
looks like a bug.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101849

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


[PATCH] D101974: [Utils][WIP] Refactor script for cc tests

2021-05-06 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis created this revision.
ggeorgakoudis requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: cfe-commits, sstefan1.
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101974

Files:
  clang/utils/refactor_cc_tests.py

Index: clang/utils/refactor_cc_tests.py
===
--- /dev/null
+++ clang/utils/refactor_cc_tests.py
@@ -0,0 +1,133 @@
+#!/usr/bin/env python3
+
+import argparse
+import re
+import subprocess
+import sys
+import multiprocessing
+from itertools import repeat
+from itertools import starmap
+
+def run_update_cc(filename, llvm_util_dir, llvm_bin):
+# Probably we don't need to those arguments since we added a NOTE line.
+update_cc = [ llvm_util_dir + '/update_cc_test_checks.py', '--llvm-bin', llvm_bin,
+'--include-generated-func',
+'--function-signature',
+'--replace-value-regex', '\"__omp_offloading_[0-9a-z]+_[0-9a-z]+\"',
+'\"reduction_size[.].+[.]\"',
+'\"pl_cond[.].+[.|,]\"',
+'--prefix-filecheck-ir-name', '_',
+filename]
+
+# Run update_cc_test_checks.py.
+print('Running update_cc')
+popen = subprocess.Popen(update_cc, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
+stdout, stderr = popen.communicate()
+if popen.returncode != 0:
+sys.stderr.write('Failed to run update_cc '+ ' '.join(update_cc) + '\n')
+sys.stderr.write(stderr)
+sys.stderr.write(stdout)
+return popen.returncode
+
+return popen.returncode
+
+def refactor(filename, llvm_util_dir, llvm_bin):
+input_lines = ''
+print('Processing file ', filename, '...')
+with open(filename, 'r') as f:
+output_lines = ''
+cnt = 1
+check_prefix_set = {'CHECK'}
+for line in f:
+input_lines += line
+# Modify run line.
+if line.startswith('// RUN'):
+# Process FileCheck in line.
+if 'FileCheck' in line:
+m = re.findall(r'--?check-prefix(?:es)?(?:\s|=)(.+?)\s+', line)
+# Extract check prefixes to remove check lines.
+check_prefix_list = []
+for i in m:
+check_prefix_list += i.split(',')
+check_prefix_set.update(set(check_prefix_list))
+# Delete all check prefixes.
+if m:
+line = re.sub(r'(?:-|--)check-prefix(?:es|)(?:\s|=).+?\s+', r'', line)
+
+# Generate implicit check.
+if '-fopenmp-simd' in line and not re.search(r'\b-fopenmp\b', line):
+line = line[:-1] + ' --implicit-check-not="{{__kmpc|__tgt}}"\n'
+# Generate check prefix using the counter.
+else:
+line = line[:-1] + ' --check-prefix=CHECK%d\n'%(cnt)
+cnt += 1
+
+# Replace generic triple.
+# TODO: add ms_abi_triple
+if '%itanium_abi_triple' in line:
+line = re.sub(r'%itanium_abi_triple', 'x86_64-unknown-linux', line)
+
+if 'clang' in line and not '-triple' in line:
+line = re.sub(r'clang(_cc1|xx)?\s+', r'clang\g<1> -triple x86_64-unknown-linux ', line)
+output_lines += line
+elif line.startswith('// NOTE:'):
+# Skip NOTE line, script will add its own.
+continue
+else:
+check_prefix_regex = '(' + '|'.join(check_prefix_set) + ')'
+# Discard check line.
+if re.match(r'\s*//\s%s'%(check_prefix_regex), line):
+continue
+
+# Skip empty comment lines to match update_cc handling.
+line_strip = line.strip()
+if line_strip == '//':
+pass
+# Keep line.
+else:
+output_lines += line
+# Add NOTE to avoid omp_offloading line number problems
+NOTE = ('// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py'
+' UTC_ARGS: --function-signature --include-generated-funcs'
+' --replace-value-regex "__omp_offloading_[0-9a-z]+_[0-9a-z]+" "reduction_size[.].+[.]" "pl_cond[.].+[.|,]"'
+' --prefix-filecheck-ir-name _\n')
+output_lines = NOTE + output_lines
+
+with open(filename, 'w') as f:
+f.write(output_lines)
+
+# Run update_cc_test_checks.py.
+ret = run_update_cc(filename, llvm_util_dir, llvm_bin)
+if ret == 0:
+# Done, return 1.
+return 1
+else:
+with open(filename, 'w') as f:
+  f.write(input_lines)
+# Failed, return 0.
+return 0
+
+def main():
+parser = 

[PATCH] D101849: [OpenMP][NFC] Refactor Clang OpenMP tests using update_cc_test_checks

2021-05-05 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG207b08a9130b: [OpenMP][NFC] Refactor Clang OpenMP tests 
using update_cc_test_checks (authored by ggeorgakoudis).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101849

Files:
  clang/test/OpenMP/cancel_codegen.cpp
  clang/test/OpenMP/cancellation_point_codegen.cpp
  clang/test/OpenMP/debug-info-complex-byval.cpp
  clang/test/OpenMP/debug-info-openmp-array.cpp
  clang/test/OpenMP/declare_target_codegen_globalization.cpp
  clang/test/OpenMP/distribute_codegen.cpp
  clang/test/OpenMP/distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_codegen.cpp
  clang/test/OpenMP/distribute_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_reduction_codegen.cpp
  clang/test/OpenMP/for_firstprivate_codegen.cpp
  clang/test/OpenMP/for_lastprivate_codegen.cpp
  clang/test/OpenMP/for_linear_codegen.cpp
  clang/test/OpenMP/for_private_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen_UDR.cpp
  clang/test/OpenMP/for_reduction_task_codegen.cpp
  clang/test/OpenMP/master_taskloop_in_reduction_codegen.cpp
  clang/test/OpenMP/master_taskloop_simd_in_reduction_codegen.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/openmp_win_codegen.cpp
  clang/test/OpenMP/ordered_codegen.cpp
  clang/test/OpenMP/parallel_codegen.cpp
  clang/test/OpenMP/parallel_copyin_codegen.cpp
  clang/test/OpenMP/parallel_firstprivate_codegen.cpp
  clang/test/OpenMP/parallel_for_codegen.cpp
  clang/test/OpenMP/parallel_for_lastprivate_conditional.cpp
  clang/test/OpenMP/parallel_for_linear_codegen.cpp
  clang/test/OpenMP/parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_if_codegen.cpp
  clang/test/OpenMP/parallel_master_codegen.cpp
  clang/test/OpenMP/parallel_master_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_lastprivate_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/parallel_private_codegen.cpp
  clang/test/OpenMP/parallel_reduction_codegen.cpp
  clang/test/OpenMP/parallel_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_sections_codegen.cpp
  clang/test/OpenMP/parallel_sections_reduction_task_codegen.cpp
  clang/test/OpenMP/sections_firstprivate_codegen.cpp
  clang/test/OpenMP/sections_lastprivate_codegen.cpp
  

[PATCH] D101952: [OpenMP] Fix non-determinism in clang copyin codegen

2021-05-05 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf97b843d8819: [OpenMP] Fix non-determinism in clang copyin 
codegen (authored by ggeorgakoudis).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101952

Files:
  clang/lib/CodeGen/CGStmtOpenMP.cpp


Index: clang/lib/CodeGen/CGStmtOpenMP.cpp
===
--- clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -1006,12 +1006,14 @@
   // need to copy data.
   CopyBegin = createBasicBlock("copyin.not.master");
   CopyEnd = createBasicBlock("copyin.not.master.end");
+  // TODO: Avoid ptrtoint conversion.
+  auto *MasterAddrInt =
+  Builder.CreatePtrToInt(MasterAddr.getPointer(), CGM.IntPtrTy);
+  auto *PrivateAddrInt =
+  Builder.CreatePtrToInt(PrivateAddr.getPointer(), CGM.IntPtrTy);
   Builder.CreateCondBr(
-  Builder.CreateICmpNE(
-  Builder.CreatePtrToInt(MasterAddr.getPointer(), 
CGM.IntPtrTy),
-  Builder.CreatePtrToInt(PrivateAddr.getPointer(),
- CGM.IntPtrTy)),
-  CopyBegin, CopyEnd);
+  Builder.CreateICmpNE(MasterAddrInt, PrivateAddrInt), CopyBegin,
+  CopyEnd);
   EmitBlock(CopyBegin);
 }
 const auto *SrcVD =


Index: clang/lib/CodeGen/CGStmtOpenMP.cpp
===
--- clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -1006,12 +1006,14 @@
   // need to copy data.
   CopyBegin = createBasicBlock("copyin.not.master");
   CopyEnd = createBasicBlock("copyin.not.master.end");
+  // TODO: Avoid ptrtoint conversion.
+  auto *MasterAddrInt =
+  Builder.CreatePtrToInt(MasterAddr.getPointer(), CGM.IntPtrTy);
+  auto *PrivateAddrInt =
+  Builder.CreatePtrToInt(PrivateAddr.getPointer(), CGM.IntPtrTy);
   Builder.CreateCondBr(
-  Builder.CreateICmpNE(
-  Builder.CreatePtrToInt(MasterAddr.getPointer(), CGM.IntPtrTy),
-  Builder.CreatePtrToInt(PrivateAddr.getPointer(),
- CGM.IntPtrTy)),
-  CopyBegin, CopyEnd);
+  Builder.CreateICmpNE(MasterAddrInt, PrivateAddrInt), CopyBegin,
+  CopyEnd);
   EmitBlock(CopyBegin);
 }
 const auto *SrcVD =
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D101952: [OpenMP] Fix non-determinism in clang copyin codegen

2021-05-05 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 343262.
ggeorgakoudis added a comment.

Update for comments


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101952

Files:
  clang/lib/CodeGen/CGStmtOpenMP.cpp


Index: clang/lib/CodeGen/CGStmtOpenMP.cpp
===
--- clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -1006,12 +1006,14 @@
   // need to copy data.
   CopyBegin = createBasicBlock("copyin.not.master");
   CopyEnd = createBasicBlock("copyin.not.master.end");
+  // TODO: Avoid ptrtoint conversion.
+  auto *MasterAddrInt =
+  Builder.CreatePtrToInt(MasterAddr.getPointer(), CGM.IntPtrTy);
+  auto *PrivateAddrInt =
+  Builder.CreatePtrToInt(PrivateAddr.getPointer(), CGM.IntPtrTy);
   Builder.CreateCondBr(
-  Builder.CreateICmpNE(
-  Builder.CreatePtrToInt(MasterAddr.getPointer(), 
CGM.IntPtrTy),
-  Builder.CreatePtrToInt(PrivateAddr.getPointer(),
- CGM.IntPtrTy)),
-  CopyBegin, CopyEnd);
+  Builder.CreateICmpNE(MasterAddrInt, PrivateAddrInt), CopyBegin,
+  CopyEnd);
   EmitBlock(CopyBegin);
 }
 const auto *SrcVD =


Index: clang/lib/CodeGen/CGStmtOpenMP.cpp
===
--- clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -1006,12 +1006,14 @@
   // need to copy data.
   CopyBegin = createBasicBlock("copyin.not.master");
   CopyEnd = createBasicBlock("copyin.not.master.end");
+  // TODO: Avoid ptrtoint conversion.
+  auto *MasterAddrInt =
+  Builder.CreatePtrToInt(MasterAddr.getPointer(), CGM.IntPtrTy);
+  auto *PrivateAddrInt =
+  Builder.CreatePtrToInt(PrivateAddr.getPointer(), CGM.IntPtrTy);
   Builder.CreateCondBr(
-  Builder.CreateICmpNE(
-  Builder.CreatePtrToInt(MasterAddr.getPointer(), CGM.IntPtrTy),
-  Builder.CreatePtrToInt(PrivateAddr.getPointer(),
- CGM.IntPtrTy)),
-  CopyBegin, CopyEnd);
+  Builder.CreateICmpNE(MasterAddrInt, PrivateAddrInt), CopyBegin,
+  CopyEnd);
   EmitBlock(CopyBegin);
 }
 const auto *SrcVD =
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D101952: [OpenMP] Fix non-determinism in clang copyin codegen

2021-05-05 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 343256.
ggeorgakoudis added a comment.

Update by Johanne's correction on the source of non-determinism


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101952

Files:
  clang/lib/CodeGen/CGStmtOpenMP.cpp


Index: clang/lib/CodeGen/CGStmtOpenMP.cpp
===
--- clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -1006,12 +1006,11 @@
   // need to copy data.
   CopyBegin = createBasicBlock("copyin.not.master");
   CopyEnd = createBasicBlock("copyin.not.master.end");
-  Builder.CreateCondBr(
-  Builder.CreateICmpNE(
-  Builder.CreatePtrToInt(MasterAddr.getPointer(), 
CGM.IntPtrTy),
-  Builder.CreatePtrToInt(PrivateAddr.getPointer(),
- CGM.IntPtrTy)),
-  CopyBegin, CopyEnd);
+  auto *A =
+  Builder.CreatePtrToInt(MasterAddr.getPointer(), CGM.IntPtrTy);
+  auto *B =
+  Builder.CreatePtrToInt(PrivateAddr.getPointer(), CGM.IntPtrTy);
+  Builder.CreateCondBr(Builder.CreateICmpNE(A, B), CopyBegin, CopyEnd);
   EmitBlock(CopyBegin);
 }
 const auto *SrcVD =


Index: clang/lib/CodeGen/CGStmtOpenMP.cpp
===
--- clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -1006,12 +1006,11 @@
   // need to copy data.
   CopyBegin = createBasicBlock("copyin.not.master");
   CopyEnd = createBasicBlock("copyin.not.master.end");
-  Builder.CreateCondBr(
-  Builder.CreateICmpNE(
-  Builder.CreatePtrToInt(MasterAddr.getPointer(), CGM.IntPtrTy),
-  Builder.CreatePtrToInt(PrivateAddr.getPointer(),
- CGM.IntPtrTy)),
-  CopyBegin, CopyEnd);
+  auto *A =
+  Builder.CreatePtrToInt(MasterAddr.getPointer(), CGM.IntPtrTy);
+  auto *B =
+  Builder.CreatePtrToInt(PrivateAddr.getPointer(), CGM.IntPtrTy);
+  Builder.CreateCondBr(Builder.CreateICmpNE(A, B), CopyBegin, CopyEnd);
   EmitBlock(CopyBegin);
 }
 const auto *SrcVD =
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D101952: [OpenMP] Fix non-determinism in clang copyin codegen

2021-05-05 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis created this revision.
Herald added subscribers: mgrang, guansong, yaxunl.
ggeorgakoudis requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: cfe-commits, sstefan1.
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101952

Files:
  clang/lib/CodeGen/CGStmtOpenMP.cpp


Index: clang/lib/CodeGen/CGStmtOpenMP.cpp
===
--- clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -971,7 +971,7 @@
   // operator=(threadprivate_var2, master_threadprivate_var2);
   // ...
   // __kmpc_barrier(, global_tid);
-  llvm::DenseSet CopiedVars;
+  llvm::SetVector CopiedVars;
   llvm::BasicBlock *CopyBegin = nullptr, *CopyEnd = nullptr;
   for (const auto *C : D.getClausesOfKind()) {
 auto IRef = C->varlist_begin();
@@ -980,7 +980,7 @@
 for (const Expr *AssignOp : C->assignment_ops()) {
   const auto *VD = cast(cast(*IRef)->getDecl());
   QualType Type = VD->getType();
-  if (CopiedVars.insert(VD->getCanonicalDecl()).second) {
+  if (CopiedVars.insert(VD->getCanonicalDecl())) {
 // Get the address of the master variable. If we are emitting code with
 // TLS support, the address is passed from the master as field in the
 // captured declaration.


Index: clang/lib/CodeGen/CGStmtOpenMP.cpp
===
--- clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -971,7 +971,7 @@
   // operator=(threadprivate_var2, master_threadprivate_var2);
   // ...
   // __kmpc_barrier(, global_tid);
-  llvm::DenseSet CopiedVars;
+  llvm::SetVector CopiedVars;
   llvm::BasicBlock *CopyBegin = nullptr, *CopyEnd = nullptr;
   for (const auto *C : D.getClausesOfKind()) {
 auto IRef = C->varlist_begin();
@@ -980,7 +980,7 @@
 for (const Expr *AssignOp : C->assignment_ops()) {
   const auto *VD = cast(cast(*IRef)->getDecl());
   QualType Type = VD->getType();
-  if (CopiedVars.insert(VD->getCanonicalDecl()).second) {
+  if (CopiedVars.insert(VD->getCanonicalDecl())) {
 // Get the address of the master variable. If we are emitting code with
 // TLS support, the address is passed from the master as field in the
 // captured declaration.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D101849: [OpenMP][NFC] Refactor Clang OpenMP tests using update_cc_test_checks

2021-05-05 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 343210.
ggeorgakoudis added a comment.

More updates to tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101849

Files:
  clang/test/OpenMP/cancel_codegen.cpp
  clang/test/OpenMP/cancellation_point_codegen.cpp
  clang/test/OpenMP/debug-info-complex-byval.cpp
  clang/test/OpenMP/debug-info-openmp-array.cpp
  clang/test/OpenMP/declare_target_codegen_globalization.cpp
  clang/test/OpenMP/distribute_codegen.cpp
  clang/test/OpenMP/distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_codegen.cpp
  clang/test/OpenMP/distribute_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_reduction_codegen.cpp
  clang/test/OpenMP/for_firstprivate_codegen.cpp
  clang/test/OpenMP/for_lastprivate_codegen.cpp
  clang/test/OpenMP/for_linear_codegen.cpp
  clang/test/OpenMP/for_private_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen_UDR.cpp
  clang/test/OpenMP/for_reduction_task_codegen.cpp
  clang/test/OpenMP/master_taskloop_in_reduction_codegen.cpp
  clang/test/OpenMP/master_taskloop_simd_in_reduction_codegen.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/openmp_win_codegen.cpp
  clang/test/OpenMP/ordered_codegen.cpp
  clang/test/OpenMP/parallel_codegen.cpp
  clang/test/OpenMP/parallel_copyin_codegen.cpp
  clang/test/OpenMP/parallel_firstprivate_codegen.cpp
  clang/test/OpenMP/parallel_for_codegen.cpp
  clang/test/OpenMP/parallel_for_lastprivate_conditional.cpp
  clang/test/OpenMP/parallel_for_linear_codegen.cpp
  clang/test/OpenMP/parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_if_codegen.cpp
  clang/test/OpenMP/parallel_master_codegen.cpp
  clang/test/OpenMP/parallel_master_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_lastprivate_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/parallel_private_codegen.cpp
  clang/test/OpenMP/parallel_reduction_codegen.cpp
  clang/test/OpenMP/parallel_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_sections_codegen.cpp
  clang/test/OpenMP/parallel_sections_reduction_task_codegen.cpp
  clang/test/OpenMP/sections_firstprivate_codegen.cpp
  clang/test/OpenMP/sections_lastprivate_codegen.cpp
  clang/test/OpenMP/sections_private_codegen.cpp
  clang/test/OpenMP/sections_reduction_codegen.cpp
  clang/test/OpenMP/sections_reduction_task_codegen.cpp
  

[PATCH] D101849: [OpenMP][NFC] Refactor Clang OpenMP tests using update_cc_test_checks

2021-05-05 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 343197.
ggeorgakoudis added a comment.

Update tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101849

Files:
  clang/test/OpenMP/cancel_codegen.cpp
  clang/test/OpenMP/cancellation_point_codegen.cpp
  clang/test/OpenMP/debug-info-complex-byval.cpp
  clang/test/OpenMP/debug-info-openmp-array.cpp
  clang/test/OpenMP/declare_target_codegen_globalization.cpp
  clang/test/OpenMP/distribute_codegen.cpp
  clang/test/OpenMP/distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_codegen.cpp
  clang/test/OpenMP/distribute_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_reduction_codegen.cpp
  clang/test/OpenMP/for_firstprivate_codegen.cpp
  clang/test/OpenMP/for_lastprivate_codegen.cpp
  clang/test/OpenMP/for_linear_codegen.cpp
  clang/test/OpenMP/for_private_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen_UDR.cpp
  clang/test/OpenMP/for_reduction_task_codegen.cpp
  clang/test/OpenMP/master_taskloop_in_reduction_codegen.cpp
  clang/test/OpenMP/master_taskloop_simd_in_reduction_codegen.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/openmp_win_codegen.cpp
  clang/test/OpenMP/ordered_codegen.cpp
  clang/test/OpenMP/parallel_codegen.cpp
  clang/test/OpenMP/parallel_copyin_codegen.cpp
  clang/test/OpenMP/parallel_firstprivate_codegen.cpp
  clang/test/OpenMP/parallel_for_codegen.cpp
  clang/test/OpenMP/parallel_for_lastprivate_conditional.cpp
  clang/test/OpenMP/parallel_for_linear_codegen.cpp
  clang/test/OpenMP/parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_if_codegen.cpp
  clang/test/OpenMP/parallel_master_codegen.cpp
  clang/test/OpenMP/parallel_master_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_lastprivate_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/parallel_private_codegen.cpp
  clang/test/OpenMP/parallel_reduction_codegen.cpp
  clang/test/OpenMP/parallel_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_sections_codegen.cpp
  clang/test/OpenMP/parallel_sections_reduction_task_codegen.cpp
  clang/test/OpenMP/sections_firstprivate_codegen.cpp
  clang/test/OpenMP/sections_lastprivate_codegen.cpp
  clang/test/OpenMP/sections_private_codegen.cpp
  clang/test/OpenMP/sections_reduction_codegen.cpp
  clang/test/OpenMP/sections_reduction_task_codegen.cpp
  clang/test/OpenMP/single_codegen.cpp
  

[PATCH] D101934: [Utils][NFC] Rename replace-function-regex in update_cc_test_checks

2021-05-05 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG78a7d8c4dd10: [Utils][NFC] Rename replace-function-regex in 
update_cc_test_checks (authored by ggeorgakoudis).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101934

Files:
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/target_parallel_debug_codegen.cpp
  clang/test/OpenMP/target_parallel_for_debug_codegen.cpp
  clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c
  clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected
  clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
  llvm/utils/UpdateTestChecks/common.py
  llvm/utils/update_analyze_test_checks.py
  llvm/utils/update_llc_test_checks.py

Index: llvm/utils/update_llc_test_checks.py
===
--- llvm/utils/update_llc_test_checks.py
+++ llvm/utils/update_llc_test_checks.py
@@ -108,12 +108,12 @@
   check_indent = ''
 
 builder = common.FunctionTestBuilder(
-run_list=run_list, 
+run_list=run_list,
 flags=type('', (object,), {
 'verbose': ti.args.verbose,
 'function_signature': False,
 'check_attributes': False,
-'replace_function_regex': []}),
+'replace_value_regex': []}),
 scrubber_args=[ti.args])
 
 for prefixes, llc_tool, llc_args, preprocess_cmd, triple_in_cmd, march_in_cmd in run_list:
Index: llvm/utils/update_analyze_test_checks.py
===
--- llvm/utils/update_analyze_test_checks.py
+++ llvm/utils/update_analyze_test_checks.py
@@ -114,7 +114,7 @@
 'verbose': args.verbose,
 'function_signature': False,
 'check_attributes': False,
-'replace_function_regex': []}),
+'replace_value_regex': []}),
   scrubber_args = [])
 
 for prefixes, opt_args in prefix_list:
Index: llvm/utils/UpdateTestChecks/common.py
===
--- llvm/utils/UpdateTestChecks/common.py
+++ llvm/utils/UpdateTestChecks/common.py
@@ -32,8 +32,8 @@
help='Activate CHECK line generation from this point forward')
   parser.add_argument('--disable', action='store_false', dest='enabled',
   help='Deactivate CHECK line generation from this point forward')
-  parser.add_argument('--replace-function-regex', nargs='+', default=[],
-  help='List of regular expressions to replace matching function names')
+  parser.add_argument('--replace-value-regex', nargs='+', default=[],
+  help='List of regular expressions to replace matching value names')
   parser.add_argument('--prefix-filecheck-ir-name', default='',
   help='Add a prefix to FileCheck IR value names to avoid conflicts with scripted names')
   args = parser.parse_args()
@@ -297,7 +297,7 @@
 self._check_attributes = flags.check_attributes
 self._scrubber_args = scrubber_args
 # Strip double-quotes if input was read by UTC_ARGS
-self._replace_function_regex = list(map(lambda x: x.strip('"'), flags.replace_function_regex))
+self._replace_value_regex = list(map(lambda x: x.strip('"'), flags.replace_value_regex))
 self._func_dict = {}
 self._func_order = {}
 self._global_var_dict = {}
@@ -372,7 +372,7 @@
   continue
 
 # Replace function names matching the regex.
-for regex in self._replace_function_regex:
+for regex in self._replace_value_regex:
   # Pattern that matches capture groups in the regex in leftmost order.
   group_regex = re.compile('\(.*?\)')
   # Replace function name with regex.
Index: clang/test/utils/update_cc_test_checks/generated-funcs-regex.test

[PATCH] D101934: [Utils][NFC] Rename replace-function-regex in update_cc_test_checks

2021-05-05 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis created this revision.
Herald added a subscriber: arichardson.
ggeorgakoudis requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: llvm-commits, cfe-commits, sstefan1.
Herald added projects: clang, LLVM.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101934

Files:
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/target_parallel_debug_codegen.cpp
  clang/test/OpenMP/target_parallel_for_debug_codegen.cpp
  clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c
  clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected
  clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
  llvm/utils/UpdateTestChecks/common.py
  llvm/utils/update_analyze_test_checks.py
  llvm/utils/update_llc_test_checks.py

Index: llvm/utils/update_llc_test_checks.py
===
--- llvm/utils/update_llc_test_checks.py
+++ llvm/utils/update_llc_test_checks.py
@@ -108,12 +108,12 @@
   check_indent = ''
 
 builder = common.FunctionTestBuilder(
-run_list=run_list, 
+run_list=run_list,
 flags=type('', (object,), {
 'verbose': ti.args.verbose,
 'function_signature': False,
 'check_attributes': False,
-'replace_function_regex': []}),
+'replace_value_regex': []}),
 scrubber_args=[ti.args])
 
 for prefixes, llc_tool, llc_args, preprocess_cmd, triple_in_cmd, march_in_cmd in run_list:
Index: llvm/utils/update_analyze_test_checks.py
===
--- llvm/utils/update_analyze_test_checks.py
+++ llvm/utils/update_analyze_test_checks.py
@@ -114,7 +114,7 @@
 'verbose': args.verbose,
 'function_signature': False,
 'check_attributes': False,
-'replace_function_regex': []}),
+'replace_value_regex': []}),
   scrubber_args = [])
 
 for prefixes, opt_args in prefix_list:
Index: llvm/utils/UpdateTestChecks/common.py
===
--- llvm/utils/UpdateTestChecks/common.py
+++ llvm/utils/UpdateTestChecks/common.py
@@ -32,8 +32,8 @@
help='Activate CHECK line generation from this point forward')
   parser.add_argument('--disable', action='store_false', dest='enabled',
   help='Deactivate CHECK line generation from this point forward')
-  parser.add_argument('--replace-function-regex', nargs='+', default=[],
-  help='List of regular expressions to replace matching function names')
+  parser.add_argument('--replace-value-regex', nargs='+', default=[],
+  help='List of regular expressions to replace matching value names')
   parser.add_argument('--prefix-filecheck-ir-name', default='',
   help='Add a prefix to FileCheck IR value names to avoid conflicts with scripted names')
   args = parser.parse_args()
@@ -297,7 +297,7 @@
 self._check_attributes = flags.check_attributes
 self._scrubber_args = scrubber_args
 # Strip double-quotes if input was read by UTC_ARGS
-self._replace_function_regex = list(map(lambda x: x.strip('"'), flags.replace_function_regex))
+self._replace_value_regex = list(map(lambda x: x.strip('"'), flags.replace_value_regex))
 self._func_dict = {}
 self._func_order = {}
 self._global_var_dict = {}
@@ -372,7 +372,7 @@
   continue
 
 # Replace function names matching the regex.
-for regex in self._replace_function_regex:
+for regex in self._replace_value_regex:
   # Pattern that matches capture groups in the regex in leftmost order.
   group_regex = re.compile('\(.*?\)')
   # Replace function name with regex.
Index: clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
===
--- 

[PATCH] D101849: [OpenMP][NFC] Refactor Clang OpenMP tests using update_cc_test_checks

2021-05-04 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG956cae2f09b2: [OpenMP][NFC] Refactor Clang OpenMP tests 
using update_cc_test_checks (authored by ggeorgakoudis).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101849

Files:
  clang/test/OpenMP/cancel_codegen.cpp
  clang/test/OpenMP/cancellation_point_codegen.cpp
  clang/test/OpenMP/debug-info-complex-byval.cpp
  clang/test/OpenMP/debug-info-openmp-array.cpp
  clang/test/OpenMP/declare_target_codegen_globalization.cpp
  clang/test/OpenMP/distribute_codegen.cpp
  clang/test/OpenMP/distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_codegen.cpp
  clang/test/OpenMP/distribute_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_reduction_codegen.cpp
  clang/test/OpenMP/for_firstprivate_codegen.cpp
  clang/test/OpenMP/for_lastprivate_codegen.cpp
  clang/test/OpenMP/for_linear_codegen.cpp
  clang/test/OpenMP/for_private_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen_UDR.cpp
  clang/test/OpenMP/for_reduction_task_codegen.cpp
  clang/test/OpenMP/master_taskloop_in_reduction_codegen.cpp
  clang/test/OpenMP/master_taskloop_simd_in_reduction_codegen.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/openmp_win_codegen.cpp
  clang/test/OpenMP/ordered_codegen.cpp
  clang/test/OpenMP/parallel_codegen.cpp
  clang/test/OpenMP/parallel_copyin_codegen.cpp
  clang/test/OpenMP/parallel_firstprivate_codegen.cpp
  clang/test/OpenMP/parallel_for_codegen.cpp
  clang/test/OpenMP/parallel_for_lastprivate_conditional.cpp
  clang/test/OpenMP/parallel_for_linear_codegen.cpp
  clang/test/OpenMP/parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_if_codegen.cpp
  clang/test/OpenMP/parallel_master_codegen.cpp
  clang/test/OpenMP/parallel_master_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_lastprivate_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/parallel_private_codegen.cpp
  clang/test/OpenMP/parallel_reduction_codegen.cpp
  clang/test/OpenMP/parallel_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_sections_codegen.cpp
  clang/test/OpenMP/parallel_sections_reduction_task_codegen.cpp
  clang/test/OpenMP/sections_firstprivate_codegen.cpp
  clang/test/OpenMP/sections_lastprivate_codegen.cpp
  

[PATCH] D101849: [OpenMP][NFC] Refactor Clang OpenMP tests using update_cc_test_checks

2021-05-04 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis created this revision.
Herald added subscribers: jfb, guansong, yaxunl.
ggeorgakoudis requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: cfe-commits, sstefan1.
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101849

Files:
  clang/test/OpenMP/cancel_codegen.cpp
  clang/test/OpenMP/cancellation_point_codegen.cpp
  clang/test/OpenMP/debug-info-complex-byval.cpp
  clang/test/OpenMP/debug-info-openmp-array.cpp
  clang/test/OpenMP/declare_target_codegen_globalization.cpp
  clang/test/OpenMP/distribute_codegen.cpp
  clang/test/OpenMP/distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_codegen.cpp
  clang/test/OpenMP/distribute_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_reduction_codegen.cpp
  clang/test/OpenMP/for_firstprivate_codegen.cpp
  clang/test/OpenMP/for_lastprivate_codegen.cpp
  clang/test/OpenMP/for_linear_codegen.cpp
  clang/test/OpenMP/for_private_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen_UDR.cpp
  clang/test/OpenMP/for_reduction_task_codegen.cpp
  clang/test/OpenMP/master_taskloop_in_reduction_codegen.cpp
  clang/test/OpenMP/master_taskloop_simd_in_reduction_codegen.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/openmp_win_codegen.cpp
  clang/test/OpenMP/ordered_codegen.cpp
  clang/test/OpenMP/parallel_codegen.cpp
  clang/test/OpenMP/parallel_copyin_codegen.cpp
  clang/test/OpenMP/parallel_firstprivate_codegen.cpp
  clang/test/OpenMP/parallel_for_codegen.cpp
  clang/test/OpenMP/parallel_for_lastprivate_conditional.cpp
  clang/test/OpenMP/parallel_for_linear_codegen.cpp
  clang/test/OpenMP/parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_if_codegen.cpp
  clang/test/OpenMP/parallel_master_codegen.cpp
  clang/test/OpenMP/parallel_master_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_lastprivate_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/parallel_private_codegen.cpp
  clang/test/OpenMP/parallel_reduction_codegen.cpp
  clang/test/OpenMP/parallel_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_sections_codegen.cpp
  clang/test/OpenMP/parallel_sections_reduction_task_codegen.cpp
  clang/test/OpenMP/sections_firstprivate_codegen.cpp
  clang/test/OpenMP/sections_lastprivate_codegen.cpp
  clang/test/OpenMP/sections_private_codegen.cpp
  clang/test/OpenMP/sections_reduction_codegen.cpp
  

[PATCH] D101683: [Utils] Run non-filecheck runlines in-order in update_cc_test_checks

2021-05-04 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG92f2c39f915a: [Utils] Run non-filecheck runlines in-order in 
update_cc_test_checks (authored by ggeorgakoudis).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101683

Files:
  clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c
  clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected
  llvm/utils/update_cc_test_checks.py

Index: llvm/utils/update_cc_test_checks.py
===
--- llvm/utils/update_cc_test_checks.py
+++ llvm/utils/update_cc_test_checks.py
@@ -218,7 +218,7 @@
 
   for ti in common.itertests(initial_args.tests, parser, 'utils/' + script_name,
  comment_prefix='//', argparse_callback=infer_dependent_args):
-# Build a list of clang command lines and check prefixes from RUN lines.
+# Build a list of filechecked and non-filechecked RUN lines.
 run_list = []
 line2spell_and_mangled_list = collections.defaultdict(list)
 
@@ -240,11 +240,10 @@
   exec_args = shlex.split(commands[0])
   # Execute non-clang runline.
   if exec_args[0] not in SUBST:
-print('NOTE: Executing non-clang RUN line: ' + l, file=sys.stderr)
 # Do lit-like substitutions.
 for s in subs:
   exec_args = [i.replace(s, subs[s]) if s in i else i for i in exec_args]
-exec_run_line(exec_args)
+run_list.append((None, exec_args, None, None))
 continue
   # This is a clang runline, apply %clang substitution rule, do lit-like substitutions,
   # and append args.clang_args
@@ -258,10 +257,9 @@
   filecheck_cmd = commands[-1]
   common.verify_filecheck_prefixes(filecheck_cmd)
   if not filecheck_cmd.startswith('FileCheck '):
-print('NOTE: Executing non-FileChecked clang RUN line: ' + l, file=sys.stderr)
 # Execute non-filechecked clang runline.
 exe = [ti.args.clang] + clang_args
-exec_run_line(exe)
+run_list.append((None, exe, None, None))
 continue
 
   check_prefixes = [item for m in common.CHECK_PREFIX_RE.finditer(filecheck_cmd)
@@ -272,12 +270,21 @@
 
 # Execute clang, generate LLVM IR, and extract functions.
 
+# Store only filechecked runlines.
+filecheck_run_list = [i for i in run_list if i[0]]
 builder = common.FunctionTestBuilder(
-  run_list=run_list,
+  run_list=filecheck_run_list,
   flags=ti.args,
   scrubber_args=[])
 
-for prefixes, clang_args, extra_commands, triple_in_cmd in run_list:
+for prefixes, args, extra_commands, triple_in_cmd in run_list:
+  # Execute non-filechecked runline.
+  if not prefixes:
+print('NOTE: Executing non-FileChecked RUN line: ' + ' '.join(args), file=sys.stderr)
+exec_run_line(args)
+continue
+
+  clang_args = args
   common.debug('Extracted clang cmd: clang {}'.format(clang_args))
   common.debug('Extracted FileCheck prefixes: {}'.format(prefixes))
 
@@ -291,7 +298,7 @@
 
 func_dict = builder.finish_and_get_func_dict()
 global_vars_seen_dict = {}
-prefix_set = set([prefix for p in run_list for prefix in p[0]])
+prefix_set = set([prefix for p in filecheck_run_list for prefix in p[0]])
 output_lines = []
 
 include_generated_funcs = common.find_arg_in_test(ti,
@@ -325,7 +332,7 @@
  prefixes,
  func_dict, func)
 
-  common.add_checks_at_end(output_lines, run_list, builder.func_order(),
+  common.add_checks_at_end(output_lines, filecheck_run_list, builder.func_order(),
'//', lambda my_output_lines, prefixes, func:
check_generator(my_output_lines,
prefixes, func))
@@ -359,7 +366,7 @@
   if added:
 output_lines.append('//')
   added.add(mangled)
-  common.add_ir_checks(output_lines, '//', run_list, func_dict, mangled,
+  common.add_ir_checks(output_lines, '//', filecheck_run_list, func_dict, mangled,
False, args.function_signature, global_vars_seen_dict)
   if line.rstrip('\n') == '//':
 include_line = False
Index: clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected
===
--- clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected
+++ clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected
@@ -3,16 +3,38 @@
 // RUN: cp %s %S/Output/execute-all-runlines.copy.c
 // RUN: cp %S/Output/execute-all-runlines.copy.c %s.copy.c
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fopenmp %s.copy.c -emit-llvm-bc -o %t-host.bc
-// RUN: 

[PATCH] D101800: [OpenMP] Fix non-determinism in clang task codegen (lastprivates)

2021-05-04 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG313ee609e16b: [OpenMP] Fix non-determinism in clang task 
codegen (lastprivates) (authored by ggeorgakoudis).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101800

Files:
  clang/lib/CodeGen/CGStmtOpenMP.cpp


Index: clang/lib/CodeGen/CGStmtOpenMP.cpp
===
--- clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -4293,7 +4293,7 @@
 }
   }
   // Get list of lastprivate variables (for taskloops).
-  llvm::DenseMap LastprivateDstsOrigs;
+  llvm::MapVector LastprivateDstsOrigs;
   for (const auto *C : S.getClausesOfKind()) {
 auto IRef = C->varlist_begin();
 auto ID = C->destination_exprs().begin();
@@ -4304,8 +4304,8 @@
 Data.LastprivateCopies.push_back(IInit);
   }
   LastprivateDstsOrigs.insert(
-  {cast(cast(*ID)->getDecl()),
-   cast(*IRef)});
+  std::make_pair(cast(cast(*ID)->getDecl()),
+ cast(*IRef)));
   ++IRef;
   ++ID;
 }


Index: clang/lib/CodeGen/CGStmtOpenMP.cpp
===
--- clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -4293,7 +4293,7 @@
 }
   }
   // Get list of lastprivate variables (for taskloops).
-  llvm::DenseMap LastprivateDstsOrigs;
+  llvm::MapVector LastprivateDstsOrigs;
   for (const auto *C : S.getClausesOfKind()) {
 auto IRef = C->varlist_begin();
 auto ID = C->destination_exprs().begin();
@@ -4304,8 +4304,8 @@
 Data.LastprivateCopies.push_back(IInit);
   }
   LastprivateDstsOrigs.insert(
-  {cast(cast(*ID)->getDecl()),
-   cast(*IRef)});
+  std::make_pair(cast(cast(*ID)->getDecl()),
+ cast(*IRef)));
   ++IRef;
   ++ID;
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D101800: [OpenMP] Fix non-determinism in clang task codegen (lastprivates)

2021-05-03 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis created this revision.
Herald added subscribers: mgrang, guansong, yaxunl.
ggeorgakoudis requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: cfe-commits, sstefan1.
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101800

Files:
  clang/lib/CodeGen/CGStmtOpenMP.cpp


Index: clang/lib/CodeGen/CGStmtOpenMP.cpp
===
--- clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -4293,7 +4293,7 @@
 }
   }
   // Get list of lastprivate variables (for taskloops).
-  llvm::DenseMap LastprivateDstsOrigs;
+  llvm::MapVector LastprivateDstsOrigs;
   for (const auto *C : S.getClausesOfKind()) {
 auto IRef = C->varlist_begin();
 auto ID = C->destination_exprs().begin();
@@ -4304,8 +4304,8 @@
 Data.LastprivateCopies.push_back(IInit);
   }
   LastprivateDstsOrigs.insert(
-  {cast(cast(*ID)->getDecl()),
-   cast(*IRef)});
+  std::make_pair(cast(cast(*ID)->getDecl()),
+ cast(*IRef)));
   ++IRef;
   ++ID;
 }


Index: clang/lib/CodeGen/CGStmtOpenMP.cpp
===
--- clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -4293,7 +4293,7 @@
 }
   }
   // Get list of lastprivate variables (for taskloops).
-  llvm::DenseMap LastprivateDstsOrigs;
+  llvm::MapVector LastprivateDstsOrigs;
   for (const auto *C : S.getClausesOfKind()) {
 auto IRef = C->varlist_begin();
 auto ID = C->destination_exprs().begin();
@@ -4304,8 +4304,8 @@
 Data.LastprivateCopies.push_back(IInit);
   }
   LastprivateDstsOrigs.insert(
-  {cast(cast(*ID)->getDecl()),
-   cast(*IRef)});
+  std::make_pair(cast(cast(*ID)->getDecl()),
+ cast(*IRef)));
   ++IRef;
   ++ID;
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D101739: [OpenMP] Fix non-determinism in clang task codegen

2021-05-03 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa27ca15dd083: [OpenMP] Fix non-determinism in clang task 
codegen (authored by ggeorgakoudis).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101739

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGOpenMPRuntime.h
  clang/lib/CodeGen/CGStmtOpenMP.cpp


Index: clang/lib/CodeGen/CGStmtOpenMP.cpp
===
--- clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -4339,7 +4339,8 @@
   auto & = [, , CS, , ,
 CapturedRegion](CodeGenFunction ,
 PrePostActionTy ) {
-llvm::DenseMap, std::pair>
+llvm::MapVector,
+std::pair>
 UntiedLocalVars;
 // Set proper addresses for generated private copies.
 OMPPrivateScope Scope(CGF);
@@ -4392,7 +4393,12 @@
   Ty = CGF.getContext().getPointerType(Ty);
 Address PrivatePtr = CGF.CreateMemTemp(
 CGF.getContext().getPointerType(Ty), ".local.ptr.addr");
-UntiedLocalVars.try_emplace(VD, PrivatePtr, Address::invalid());
+auto Result = UntiedLocalVars.insert(
+std::make_pair(VD, std::make_pair(PrivatePtr, 
Address::invalid(;
+// If key exists update in place.
+if (Result.second == false)
+  *Result.first = std::make_pair(
+  VD, std::make_pair(PrivatePtr, Address::invalid()));
 CallArgs.push_back(PrivatePtr.getPointer());
 ParamTypes.push_back(PrivatePtr.getType());
   }
@@ -4424,14 +4430,14 @@
 if (isAllocatableDecl(Pair.first)) {
   llvm::Value *Ptr = CGF.Builder.CreateLoad(Pair.second.first);
   Address Replacement(Ptr, CGF.getPointerAlign());
-  Pair.getSecond().first = Replacement;
+  Pair.second.first = Replacement;
   Ptr = CGF.Builder.CreateLoad(Replacement);
   Replacement = Address(Ptr, 
CGF.getContext().getDeclAlign(Pair.first));
-  Pair.getSecond().second = Replacement;
+  Pair.second.second = Replacement;
 } else {
   llvm::Value *Ptr = CGF.Builder.CreateLoad(Pair.second.first);
   Address Replacement(Ptr, CGF.getContext().getDeclAlign(Pair.first));
-  Pair.getSecond().first = Replacement;
+  Pair.second.first = Replacement;
 }
   }
 }
Index: clang/lib/CodeGen/CGOpenMPRuntime.h
===
--- clang/lib/CodeGen/CGOpenMPRuntime.h
+++ clang/lib/CodeGen/CGOpenMPRuntime.h
@@ -253,8 +253,8 @@
   public:
 UntiedTaskLocalDeclsRAII(
 CodeGenFunction ,
-const llvm::DenseMap,
- std::pair> );
+const llvm::MapVector,
+  std::pair> );
 ~UntiedTaskLocalDeclsRAII();
   };
 
@@ -723,8 +723,8 @@
   llvm::SmallVector NontemporalDeclsStack;
 
   using UntiedLocalVarsAddressesMap =
-  llvm::DenseMap,
- std::pair>;
+  llvm::MapVector,
+  std::pair>;
   llvm::SmallVector UntiedLocalVarsStack;
 
   /// Stack for list of addresses of declarations in current context marked as
Index: clang/lib/CodeGen/CGOpenMPRuntime.cpp
===
--- clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -12107,8 +12107,8 @@
 
 CGOpenMPRuntime::UntiedTaskLocalDeclsRAII::UntiedTaskLocalDeclsRAII(
 CodeGenFunction ,
-const llvm::DenseMap,
- std::pair> )
+const llvm::MapVector,
+  std::pair> )
 : CGM(CGF.CGM), NeedToPush(!LocalVars.empty()) {
   if (!NeedToPush)
 return;


Index: clang/lib/CodeGen/CGStmtOpenMP.cpp
===
--- clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -4339,7 +4339,8 @@
   auto & = [, , CS, , ,
 CapturedRegion](CodeGenFunction ,
 PrePostActionTy ) {
-llvm::DenseMap, std::pair>
+llvm::MapVector,
+std::pair>
 UntiedLocalVars;
 // Set proper addresses for generated private copies.
 OMPPrivateScope Scope(CGF);
@@ -4392,7 +4393,12 @@
   Ty = CGF.getContext().getPointerType(Ty);
 Address PrivatePtr = CGF.CreateMemTemp(
 CGF.getContext().getPointerType(Ty), ".local.ptr.addr");
-UntiedLocalVars.try_emplace(VD, PrivatePtr, Address::invalid());
+auto Result = UntiedLocalVars.insert(
+std::make_pair(VD, std::make_pair(PrivatePtr, Address::invalid(;
+// If key exists update in place.
+if (Result.second == false)
+  *Result.first = std::make_pair(
+  VD, 

[PATCH] D101739: [OpenMP] Fix non-determinism in clang task codegen

2021-05-02 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis created this revision.
Herald added subscribers: mgrang, guansong, yaxunl.
ggeorgakoudis requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: cfe-commits, sstefan1.
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101739

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGOpenMPRuntime.h
  clang/lib/CodeGen/CGStmtOpenMP.cpp


Index: clang/lib/CodeGen/CGStmtOpenMP.cpp
===
--- clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -4339,7 +4339,8 @@
   auto & = [, , CS, , ,
 CapturedRegion](CodeGenFunction ,
 PrePostActionTy ) {
-llvm::DenseMap, std::pair>
+llvm::MapVector,
+std::pair>
 UntiedLocalVars;
 // Set proper addresses for generated private copies.
 OMPPrivateScope Scope(CGF);
@@ -4392,7 +4393,12 @@
   Ty = CGF.getContext().getPointerType(Ty);
 Address PrivatePtr = CGF.CreateMemTemp(
 CGF.getContext().getPointerType(Ty), ".local.ptr.addr");
-UntiedLocalVars.try_emplace(VD, PrivatePtr, Address::invalid());
+auto Result = UntiedLocalVars.insert(
+std::make_pair(VD, std::make_pair(PrivatePtr, 
Address::invalid(;
+// If key exists update in place.
+if (Result.second == false)
+  *Result.first = std::make_pair(
+  VD, std::make_pair(PrivatePtr, Address::invalid()));
 CallArgs.push_back(PrivatePtr.getPointer());
 ParamTypes.push_back(PrivatePtr.getType());
   }
@@ -4424,14 +4430,14 @@
 if (isAllocatableDecl(Pair.first)) {
   llvm::Value *Ptr = CGF.Builder.CreateLoad(Pair.second.first);
   Address Replacement(Ptr, CGF.getPointerAlign());
-  Pair.getSecond().first = Replacement;
+  Pair.second.first = Replacement;
   Ptr = CGF.Builder.CreateLoad(Replacement);
   Replacement = Address(Ptr, 
CGF.getContext().getDeclAlign(Pair.first));
-  Pair.getSecond().second = Replacement;
+  Pair.second.second = Replacement;
 } else {
   llvm::Value *Ptr = CGF.Builder.CreateLoad(Pair.second.first);
   Address Replacement(Ptr, CGF.getContext().getDeclAlign(Pair.first));
-  Pair.getSecond().first = Replacement;
+  Pair.second.first = Replacement;
 }
   }
 }
Index: clang/lib/CodeGen/CGOpenMPRuntime.h
===
--- clang/lib/CodeGen/CGOpenMPRuntime.h
+++ clang/lib/CodeGen/CGOpenMPRuntime.h
@@ -253,8 +253,8 @@
   public:
 UntiedTaskLocalDeclsRAII(
 CodeGenFunction ,
-const llvm::DenseMap,
- std::pair> );
+const llvm::MapVector,
+  std::pair> );
 ~UntiedTaskLocalDeclsRAII();
   };
 
@@ -723,8 +723,8 @@
   llvm::SmallVector NontemporalDeclsStack;
 
   using UntiedLocalVarsAddressesMap =
-  llvm::DenseMap,
- std::pair>;
+  llvm::MapVector,
+  std::pair>;
   llvm::SmallVector UntiedLocalVarsStack;
 
   /// Stack for list of addresses of declarations in current context marked as
Index: clang/lib/CodeGen/CGOpenMPRuntime.cpp
===
--- clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -12107,8 +12107,8 @@
 
 CGOpenMPRuntime::UntiedTaskLocalDeclsRAII::UntiedTaskLocalDeclsRAII(
 CodeGenFunction ,
-const llvm::DenseMap,
- std::pair> )
+const llvm::MapVector,
+  std::pair> )
 : CGM(CGF.CGM), NeedToPush(!LocalVars.empty()) {
   if (!NeedToPush)
 return;


Index: clang/lib/CodeGen/CGStmtOpenMP.cpp
===
--- clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -4339,7 +4339,8 @@
   auto & = [, , CS, , ,
 CapturedRegion](CodeGenFunction ,
 PrePostActionTy ) {
-llvm::DenseMap, std::pair>
+llvm::MapVector,
+std::pair>
 UntiedLocalVars;
 // Set proper addresses for generated private copies.
 OMPPrivateScope Scope(CGF);
@@ -4392,7 +4393,12 @@
   Ty = CGF.getContext().getPointerType(Ty);
 Address PrivatePtr = CGF.CreateMemTemp(
 CGF.getContext().getPointerType(Ty), ".local.ptr.addr");
-UntiedLocalVars.try_emplace(VD, PrivatePtr, Address::invalid());
+auto Result = UntiedLocalVars.insert(
+std::make_pair(VD, std::make_pair(PrivatePtr, Address::invalid(;
+// If key exists update in place.
+if (Result.second == false)
+  *Result.first = std::make_pair(
+  VD, 

[PATCH] D101683: [Utils] Run non-filecheck runlines in-order in update_cc_test_checks

2021-04-30 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis created this revision.
ggeorgakoudis requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: llvm-commits, cfe-commits, sstefan1.
Herald added projects: clang, LLVM.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101683

Files:
  clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c
  clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected
  llvm/utils/update_cc_test_checks.py

Index: llvm/utils/update_cc_test_checks.py
===
--- llvm/utils/update_cc_test_checks.py
+++ llvm/utils/update_cc_test_checks.py
@@ -218,7 +218,7 @@
 
   for ti in common.itertests(initial_args.tests, parser, 'utils/' + script_name,
  comment_prefix='//', argparse_callback=infer_dependent_args):
-# Build a list of clang command lines and check prefixes from RUN lines.
+# Build a list of filechecked and non-filechecked RUN lines.
 run_list = []
 line2spell_and_mangled_list = collections.defaultdict(list)
 
@@ -240,11 +240,10 @@
   exec_args = shlex.split(commands[0])
   # Execute non-clang runline.
   if exec_args[0] not in SUBST:
-print('NOTE: Executing non-clang RUN line: ' + l, file=sys.stderr)
 # Do lit-like substitutions.
 for s in subs:
   exec_args = [i.replace(s, subs[s]) if s in i else i for i in exec_args]
-exec_run_line(exec_args)
+run_list.append((None, exec_args, None, None))
 continue
   # This is a clang runline, apply %clang substitution rule, do lit-like substitutions,
   # and append args.clang_args
@@ -258,10 +257,9 @@
   filecheck_cmd = commands[-1]
   common.verify_filecheck_prefixes(filecheck_cmd)
   if not filecheck_cmd.startswith('FileCheck '):
-print('NOTE: Executing non-FileChecked clang RUN line: ' + l, file=sys.stderr)
 # Execute non-filechecked clang runline.
 exe = [ti.args.clang] + clang_args
-exec_run_line(exe)
+run_list.append((None, exe, None, None))
 continue
 
   check_prefixes = [item for m in common.CHECK_PREFIX_RE.finditer(filecheck_cmd)
@@ -272,12 +270,21 @@
 
 # Execute clang, generate LLVM IR, and extract functions.
 
+# Store only filechecked runlines.
+filecheck_run_list = [i for i in run_list if i[0]]
 builder = common.FunctionTestBuilder(
-  run_list=run_list,
+  run_list=filecheck_run_list,
   flags=ti.args,
   scrubber_args=[])
 
-for prefixes, clang_args, extra_commands, triple_in_cmd in run_list:
+for prefixes, args, extra_commands, triple_in_cmd in run_list:
+  # Execute non-filechecked runline.
+  if not prefixes:
+print('NOTE: Executing non-FileChecked RUN line: ' + ' '.join(args), file=sys.stderr)
+exec_run_line(args)
+continue
+
+  clang_args = args
   common.debug('Extracted clang cmd: clang {}'.format(clang_args))
   common.debug('Extracted FileCheck prefixes: {}'.format(prefixes))
 
@@ -291,7 +298,7 @@
 
 func_dict = builder.finish_and_get_func_dict()
 global_vars_seen_dict = {}
-prefix_set = set([prefix for p in run_list for prefix in p[0]])
+prefix_set = set([prefix for p in filecheck_run_list for prefix in p[0]])
 output_lines = []
 
 include_generated_funcs = common.find_arg_in_test(ti,
@@ -325,7 +332,7 @@
  prefixes,
  func_dict, func)
 
-  common.add_checks_at_end(output_lines, run_list, builder.func_order(),
+  common.add_checks_at_end(output_lines, filecheck_run_list, builder.func_order(),
'//', lambda my_output_lines, prefixes, func:
check_generator(my_output_lines,
prefixes, func))
@@ -359,7 +366,7 @@
   if added:
 output_lines.append('//')
   added.add(mangled)
-  common.add_ir_checks(output_lines, '//', run_list, func_dict, mangled,
+  common.add_ir_checks(output_lines, '//', filecheck_run_list, func_dict, mangled,
False, args.function_signature, global_vars_seen_dict)
   if line.rstrip('\n') == '//':
 include_line = False
Index: clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected
===
--- clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected
+++ clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected
@@ -3,16 +3,38 @@
 // RUN: cp %s %S/Output/execute-all-runlines.copy.c
 // RUN: cp %S/Output/execute-all-runlines.copy.c %s.copy.c
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fopenmp %s.copy.c -emit-llvm-bc -o %t-host.bc
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fopenmp 

[PATCH] D95976: [OpenMP] Simplify offloading parallel call codegen

2021-04-29 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis added a comment.

In D95976#2725027 , @protze.joachim 
wrote:

> Please update the test with a NFC commit.

Thanks, @protze.joachim. The changes look good. I'll get that NFC commit in 
soon-ish, unless you would like to take over.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95976

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


[PATCH] D95976: [OpenMP] Simplify offloading parallel call codegen

2021-04-21 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa2dbfb6b72db: [OpenMP] Simplify offloading parallel call 
codegen (authored by ggeorgakoudis).

Changed prior to commit:
  https://reviews.llvm.org/D95976?vs=339334=339441#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95976

Files:
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/remarks_parallel_in_multiple_target_state_machines.c
  clang/test/OpenMP/remarks_parallel_in_target_state_machine.c
  clang/test/OpenMP/target_parallel_debug_codegen.cpp
  clang/test/OpenMP/target_parallel_for_debug_codegen.cpp
  llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
  llvm/lib/Transforms/IPO/OpenMPOpt.cpp
  llvm/test/Transforms/OpenMP/gpu_state_machine_function_ptr_replacement.ll
  openmp/libomptarget/deviceRTLs/common/generated_microtask_cases.gen
  openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
  openmp/libomptarget/deviceRTLs/common/src/parallel.cu
  openmp/libomptarget/deviceRTLs/common/src/support.cu
  openmp/libomptarget/deviceRTLs/common/support.h
  openmp/libomptarget/deviceRTLs/interface.h
  openmp/libomptarget/test/offloading/bug49779.cpp
  openmp/libomptarget/utils/generate_microtask_cases.py

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


[PATCH] D95976: [OpenMP] Simplify offloading parallel call codegen

2021-04-21 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 339334.
ggeorgakoudis added a comment.

Fix clang-format


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95976

Files:
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/remarks_parallel_in_multiple_target_state_machines.c
  clang/test/OpenMP/remarks_parallel_in_target_state_machine.c
  clang/test/OpenMP/target_parallel_debug_codegen.cpp
  clang/test/OpenMP/target_parallel_for_debug_codegen.cpp
  llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
  llvm/lib/Transforms/IPO/OpenMPOpt.cpp
  llvm/test/Transforms/OpenMP/gpu_state_machine_function_ptr_replacement.ll
  openmp/libomptarget/deviceRTLs/common/generated_microtask_cases.gen
  openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
  openmp/libomptarget/deviceRTLs/common/src/parallel.cu
  openmp/libomptarget/deviceRTLs/common/src/support.cu
  openmp/libomptarget/deviceRTLs/common/support.h
  openmp/libomptarget/deviceRTLs/interface.h
  openmp/libomptarget/test/offloading/bug49779.cpp
  openmp/libomptarget/utils/generate_microtask_cases.py

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


[PATCH] D95976: [OpenMP] Simplify offloading parallel call codegen

2021-04-21 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 339265.
ggeorgakoudis added a comment.

Add tests, reduce microtask cases to avoid stack problems


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95976

Files:
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/remarks_parallel_in_multiple_target_state_machines.c
  clang/test/OpenMP/remarks_parallel_in_target_state_machine.c
  clang/test/OpenMP/target_parallel_debug_codegen.cpp
  clang/test/OpenMP/target_parallel_for_debug_codegen.cpp
  llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
  llvm/lib/Transforms/IPO/OpenMPOpt.cpp
  llvm/test/Transforms/OpenMP/gpu_state_machine_function_ptr_replacement.ll
  openmp/libomptarget/deviceRTLs/common/generated_microtask_cases.gen
  openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
  openmp/libomptarget/deviceRTLs/common/src/parallel.cu
  openmp/libomptarget/deviceRTLs/common/src/support.cu
  openmp/libomptarget/deviceRTLs/common/support.h
  openmp/libomptarget/deviceRTLs/interface.h
  openmp/libomptarget/test/offloading/bug49779.cpp
  openmp/libomptarget/utils/generate_microtask_cases.py

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


[PATCH] D95976: [OpenMP] Simplify offloading parallel call codegen

2021-04-19 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 338554.
ggeorgakoudis marked 2 inline comments as done.
ggeorgakoudis added a comment.

Fix


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95976

Files:
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/remarks_parallel_in_multiple_target_state_machines.c
  clang/test/OpenMP/remarks_parallel_in_target_state_machine.c
  clang/test/OpenMP/target_parallel_debug_codegen.cpp
  clang/test/OpenMP/target_parallel_for_debug_codegen.cpp
  llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
  llvm/lib/Transforms/IPO/OpenMPOpt.cpp
  llvm/test/Transforms/OpenMP/gpu_state_machine_function_ptr_replacement.ll
  openmp/libomptarget/deviceRTLs/common/generated_microtask_cases.gen
  openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
  openmp/libomptarget/deviceRTLs/common/src/parallel.cu
  openmp/libomptarget/deviceRTLs/common/src/support.cu
  openmp/libomptarget/deviceRTLs/common/support.h
  openmp/libomptarget/deviceRTLs/interface.h
  openmp/libomptarget/utils/generate_microtask_cases.py

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


[PATCH] D95976: [OpenMP] Simplify offloading parallel call codegen

2021-04-19 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis marked 4 inline comments as done.
ggeorgakoudis added inline comments.



Comment at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp:1150
   llvm::Value *IsMaster =
   Bld.CreateICmpEQ(RT.getGPUThreadID(CGF), getMasterThreadID(CGF));
   Bld.CreateCondBr(IsMaster, MasterBB, EST.ExitBB);

Meinersbur wrote:
> There seem to be more unordered codegen calls, such as this one.
Some previous emitted values can be re-used, e.g., GPUThreadID in line 1150 can 
re-use the value from line 1140 , instead of re-emitted. I've kept emitting 
them as it was previously done. What is the preferred way to handle those? 



Comment at: openmp/libomptarget/deviceRTLs/common/src/parallel.cu:294
+  // TODO: Add UNLIKELY to optimize?
+  if (!if_expr) {
+__kmpc_serialized_parallel(ident, global_tid);

jdoerfert wrote:
> ggeorgakoudis wrote:
> > jdoerfert wrote:
> > > This should allow us to remove the `SeqGen` in the Clang CodeGen *and* 
> > > fix PR49777 *and* fix PR49779, a win-win-win situation.
> > Please check
> Check? Can we add the two reproducers as tests, please. One should be a clang 
> test, the other maybe a runtime test, though clang test might suffice.
Ack, will do


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95976

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


[PATCH] D95976: [OpenMP] Simplify offloading parallel call codegen

2021-04-19 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 338441.
ggeorgakoudis marked 2 inline comments as done.
ggeorgakoudis added a comment.

Update for comments, fixes


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95976

Files:
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/remarks_parallel_in_multiple_target_state_machines.c
  clang/test/OpenMP/remarks_parallel_in_target_state_machine.c
  clang/test/OpenMP/target_parallel_debug_codegen.cpp
  clang/test/OpenMP/target_parallel_for_debug_codegen.cpp
  llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
  llvm/lib/Transforms/IPO/OpenMPOpt.cpp
  llvm/test/Transforms/OpenMP/gpu_state_machine_function_ptr_replacement.ll
  openmp/libomptarget/deviceRTLs/common/generated_microtask_cases.gen
  openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
  openmp/libomptarget/deviceRTLs/common/src/parallel.cu
  openmp/libomptarget/deviceRTLs/common/src/support.cu
  openmp/libomptarget/deviceRTLs/common/support.h
  openmp/libomptarget/deviceRTLs/interface.h
  openmp/libomptarget/utils/generate_microtask_cases.py

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


[PATCH] D95976: [OpenMP] Simplify offloading parallel call codegen

2021-04-16 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis marked 4 inline comments as done.
ggeorgakoudis added inline comments.



Comment at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp:2192
 RCG(CGF);
   }
 }

jdoerfert wrote:
> Can we remove SeqGen while we are here please. We need to check in the 
> runtime anyway. That check is later folded, no need to make things more 
> complicated here.
Done



Comment at: openmp/libomptarget/deviceRTLs/common/src/parallel.cu:294
+  // TODO: Add UNLIKELY to optimize?
+  if (!if_expr) {
+__kmpc_serialized_parallel(ident, global_tid);

jdoerfert wrote:
> This should allow us to remove the `SeqGen` in the Clang CodeGen *and* fix 
> PR49777 *and* fix PR49779, a win-win-win situation.
Please check


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95976

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


[PATCH] D95976: [OpenMP] Simplify offloading parallel call codegen

2021-04-16 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 338246.
ggeorgakoudis added a comment.

Update for comments, fix for windows fix


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95976

Files:
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/remarks_parallel_in_multiple_target_state_machines.c
  clang/test/OpenMP/remarks_parallel_in_target_state_machine.c
  clang/test/OpenMP/target_parallel_debug_codegen.cpp
  clang/test/OpenMP/target_parallel_for_debug_codegen.cpp
  llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
  llvm/lib/Transforms/IPO/OpenMPOpt.cpp
  llvm/test/Transforms/OpenMP/gpu_state_machine_function_ptr_replacement.ll
  openmp/libomptarget/deviceRTLs/common/generated_microtask_cases.gen
  openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
  openmp/libomptarget/deviceRTLs/common/src/parallel.cu
  openmp/libomptarget/deviceRTLs/common/src/support.cu
  openmp/libomptarget/deviceRTLs/common/support.h
  openmp/libomptarget/deviceRTLs/interface.h
  openmp/libomptarget/utils/generate_microtask_cases.py

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


[PATCH] D95976: [OpenMP] Simplify offloading parallel call codegen

2021-04-16 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 338102.
ggeorgakoudis added a comment.

Fix for getThreadsLimit


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95976

Files:
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/remarks_parallel_in_multiple_target_state_machines.c
  clang/test/OpenMP/remarks_parallel_in_target_state_machine.c
  clang/test/OpenMP/target_parallel_debug_codegen.cpp
  clang/test/OpenMP/target_parallel_for_debug_codegen.cpp
  llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
  llvm/lib/Transforms/IPO/OpenMPOpt.cpp
  llvm/test/Transforms/OpenMP/gpu_state_machine_function_ptr_replacement.ll
  openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
  openmp/libomptarget/deviceRTLs/common/src/parallel.cu
  openmp/libomptarget/deviceRTLs/common/src/support.cu
  openmp/libomptarget/deviceRTLs/common/support.h
  openmp/libomptarget/deviceRTLs/interface.h

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


[PATCH] D95976: [OpenMP] Simplify offloading parallel call codegen

2021-04-15 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis added a comment.

Hi @Meinersbur (got word you are a windows user), @jdoerfert, could I ask your 
help in detecting why the clang tests on windows are failing? There are two 
failures I'm spotting, one is that calls to llvm.nvvm intrinsics seem 
transposed (https://reviews.llvm.org/harbormaster/unit/view/552591/) and 
another that attribute regexes are not recognized 
(https://reviews.llvm.org/harbormaster/unit/view/552593/ at 
nvptx_target_codegen.cpp:723:17). Maybe there is something else I'm missing and 
I'd appreciate the extra eyeballing on the problem.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95976

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


[PATCH] D95976: [OpenMP] Simplify offloading parallel call codegen

2021-04-14 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 337556.
ggeorgakoudis added a comment.

Fix llvm test


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95976

Files:
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/remarks_parallel_in_multiple_target_state_machines.c
  clang/test/OpenMP/remarks_parallel_in_target_state_machine.c
  clang/test/OpenMP/target_parallel_debug_codegen.cpp
  clang/test/OpenMP/target_parallel_for_debug_codegen.cpp
  llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
  llvm/lib/Transforms/IPO/OpenMPOpt.cpp
  llvm/test/Transforms/OpenMP/gpu_state_machine_function_ptr_replacement.ll
  openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
  openmp/libomptarget/deviceRTLs/common/src/parallel.cu
  openmp/libomptarget/deviceRTLs/common/src/support.cu
  openmp/libomptarget/deviceRTLs/common/support.h
  openmp/libomptarget/deviceRTLs/interface.h

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


[PATCH] D95976: [OpenMP] Simplify offloading parallel call codegen

2021-04-13 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 337183.
ggeorgakoudis added a comment.

Add aux-triple to one test, check unit test builder on windows


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95976

Files:
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/remarks_parallel_in_multiple_target_state_machines.c
  clang/test/OpenMP/remarks_parallel_in_target_state_machine.c
  clang/test/OpenMP/target_parallel_debug_codegen.cpp
  clang/test/OpenMP/target_parallel_for_debug_codegen.cpp
  llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
  llvm/lib/Transforms/IPO/OpenMPOpt.cpp
  openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
  openmp/libomptarget/deviceRTLs/common/src/parallel.cu
  openmp/libomptarget/deviceRTLs/common/src/support.cu
  openmp/libomptarget/deviceRTLs/common/support.h
  openmp/libomptarget/deviceRTLs/interface.h

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


[PATCH] D95976: [OpenMP] Simplify offloading parallel call codegen

2021-04-13 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 337141.
ggeorgakoudis added a comment.
Herald added a subscriber: hiraditya.

Add tests, update OpenMPOpt, rebase to main


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95976

Files:
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/remarks_parallel_in_multiple_target_state_machines.c
  clang/test/OpenMP/remarks_parallel_in_target_state_machine.c
  clang/test/OpenMP/target_parallel_debug_codegen.cpp
  clang/test/OpenMP/target_parallel_for_debug_codegen.cpp
  llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
  llvm/lib/Transforms/IPO/OpenMPOpt.cpp
  openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
  openmp/libomptarget/deviceRTLs/common/src/parallel.cu
  openmp/libomptarget/deviceRTLs/common/src/support.cu
  openmp/libomptarget/deviceRTLs/common/support.h
  openmp/libomptarget/deviceRTLs/interface.h

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


[PATCH] D99415: [Utils] Add prefix parameter in update test checks to avoid FileCheck conflicts

2021-03-26 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8bc2c662d9c0: [Utils] Add prefix parameter in update test 
checks to avoid FileCheck conflicts (authored by ggeorgakoudis).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99415

Files:
  clang/test/utils/update_cc_test_checks/Inputs/resolve-tmp-conflict.cpp
  
clang/test/utils/update_cc_test_checks/Inputs/resolve-tmp-conflict.cpp.expected
  clang/test/utils/update_cc_test_checks/resolve-tmp-conflict.test
  llvm/utils/UpdateTestChecks/common.py

Index: llvm/utils/UpdateTestChecks/common.py
===
--- llvm/utils/UpdateTestChecks/common.py
+++ llvm/utils/UpdateTestChecks/common.py
@@ -16,6 +16,7 @@
 
 
 _verbose = False
+_prefix_filecheck_ir_name = ''
 
 def parse_commandline_args(parser):
   parser.add_argument('--include-generated-funcs', action='store_true',
@@ -32,6 +33,8 @@
   help='Deactivate CHECK line generation from this point forward')
   parser.add_argument('--replace-function-regex', nargs='+', default=[],
   help='List of regular expressions to replace matching function names')
+  parser.add_argument('--prefix-filecheck-ir-name', default='',
+  help='Add a prefix to FileCheck IR value names to avoid conflicts with scripted names')
   args = parser.parse_args()
   global _verbose
   _verbose = args.verbose
@@ -53,6 +56,9 @@
 self.argparse_callback = argparse_callback
 self.path = test
 self.args = args
+if args.prefix_filecheck_ir_name:
+  global _prefix_filecheck_ir_name
+  _prefix_filecheck_ir_name = args.prefix_filecheck_ir_name
 self.argv = argv
 self.input_lines = input_lines
 self.run_lines = find_run_lines(test, self.input_lines)
@@ -512,11 +518,21 @@
 def is_global_scope_ir_value_match(match):
 return nameless_values[get_idx_from_ir_value_match(match)].global_ir_prefix is not None
 
+# Return true if var clashes with the scripted FileCheck check_prefix.
+def may_clash_with_default_check_prefix_name(check_prefix, var):
+  return check_prefix and re.match(r'^' + check_prefix + r'[0-9]+?$', var, re.IGNORECASE)
+
 # Create a FileCheck variable name based on an IR name.
 def get_value_name(var, check_prefix):
   var = var.replace('!', '')
+  # This is a nameless value, prepend check_prefix.
   if var.isdigit():
 var = check_prefix + var
+  else:
+# This is a named value that clashes with the check_prefix, prepend with _prefix_filecheck_ir_name,
+# if it has been defined.
+if may_clash_with_default_check_prefix_name(check_prefix, var) and _prefix_filecheck_ir_name:
+  var = _prefix_filecheck_ir_name + var
   var = var.replace('.', '_')
   var = var.replace('-', '_')
   return var.upper()
@@ -546,8 +562,9 @@
 pre, check = get_ir_prefix_from_ir_value_match(match)
 var = get_name_from_ir_value_match(match)
 for nameless_value in nameless_values:
-if nameless_value.check_prefix and re.match(r'^' + nameless_value.check_prefix + r'[0-9]+?$', var, re.IGNORECASE):
-warn("Change IR value name '%s' to prevent possible conflict with scripted FileCheck name." % (var,))
+if may_clash_with_default_check_prefix_name(nameless_value.check_prefix, var):
+  warn("Change IR value name '%s' or use -prefix-ir-filecheck-name to prevent possible conflict"
+" with scripted FileCheck name." % (var,))
 key = (var, get_check_key_from_ir_value_match(match))
 is_local_def = is_local_def_ir_value_match(match)
 if is_local_def and key in vars_seen:
Index: clang/test/utils/update_cc_test_checks/resolve-tmp-conflict.test
===
--- /dev/null
+++ clang/test/utils/update_cc_test_checks/resolve-tmp-conflict.test
@@ -0,0 +1,8 @@
+## Test that CHECK lines generated avoid naming conflicts with FileCheck IR variables
+
+# RUN: cp %S/Inputs/resolve-tmp-conflict.cpp %t.cpp && %update_cc_test_checks --function-signature --prefix-filecheck-ir-name _ %t.cpp
+# RUN: diff -u %S/Inputs/resolve-tmp-conflict.cpp.expected %t.cpp
+
+## Check that re-running update_cc_test_checks doesn't change the output
+# RUN: %update_cc_test_checks %t.cpp
+# RUN: diff -u %S/Inputs/resolve-tmp-conflict.cpp.expected %t.cpp
Index: clang/test/utils/update_cc_test_checks/Inputs/resolve-tmp-conflict.cpp.expected
===
--- /dev/null
+++ clang/test/utils/update_cc_test_checks/Inputs/resolve-tmp-conflict.cpp.expected
@@ -0,0 +1,25 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --function-signature --prefix-filecheck-ir-name _
+// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o - | FileCheck %s
+
+// CHECK-LABEL: define {{[^@]+}}@_Z3fooi
+// CHECK-SAME: 

[PATCH] D99415: [Utils] Add prefix parameter in update test checks to avoid FileCheck conflicts

2021-03-26 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 333584.
ggeorgakoudis marked an inline comment as done.
ggeorgakoudis added a comment.

Update for comments


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99415

Files:
  clang/test/utils/update_cc_test_checks/Inputs/resolve-tmp-conflict.cpp
  
clang/test/utils/update_cc_test_checks/Inputs/resolve-tmp-conflict.cpp.expected
  clang/test/utils/update_cc_test_checks/resolve-tmp-conflict.test
  llvm/utils/UpdateTestChecks/common.py

Index: llvm/utils/UpdateTestChecks/common.py
===
--- llvm/utils/UpdateTestChecks/common.py
+++ llvm/utils/UpdateTestChecks/common.py
@@ -16,6 +16,7 @@
 
 
 _verbose = False
+_prefix_filecheck_ir_name = ''
 
 def parse_commandline_args(parser):
   parser.add_argument('--include-generated-funcs', action='store_true',
@@ -32,6 +33,8 @@
   help='Deactivate CHECK line generation from this point forward')
   parser.add_argument('--replace-function-regex', nargs='+', default=[],
   help='List of regular expressions to replace matching function names')
+  parser.add_argument('--prefix-filecheck-ir-name', default='',
+  help='Add a prefix to FileCheck IR value names to avoid conflicts with scripted names')
   args = parser.parse_args()
   global _verbose
   _verbose = args.verbose
@@ -53,6 +56,9 @@
 self.argparse_callback = argparse_callback
 self.path = test
 self.args = args
+if args.prefix_filecheck_ir_name:
+  global _prefix_filecheck_ir_name
+  _prefix_filecheck_ir_name = args.prefix_filecheck_ir_name
 self.argv = argv
 self.input_lines = input_lines
 self.run_lines = find_run_lines(test, self.input_lines)
@@ -512,11 +518,21 @@
 def is_global_scope_ir_value_match(match):
 return nameless_values[get_idx_from_ir_value_match(match)].global_ir_prefix is not None
 
+# Return true if var clashes with the scripted FileCheck check_prefix.
+def may_clash_with_default_check_prefix_name(check_prefix, var):
+  return check_prefix and re.match(r'^' + check_prefix + r'[0-9]+?$', var, re.IGNORECASE)
+
 # Create a FileCheck variable name based on an IR name.
 def get_value_name(var, check_prefix):
   var = var.replace('!', '')
+  # This is a nameless value, prepend check_prefix.
   if var.isdigit():
 var = check_prefix + var
+  else:
+# This is a named value that clashes with the check_prefix, prepend with _prefix_filecheck_ir_name,
+# if it has been defined.
+if may_clash_with_default_check_prefix_name(check_prefix, var) and _prefix_filecheck_ir_name:
+  var = _prefix_filecheck_ir_name + var
   var = var.replace('.', '_')
   var = var.replace('-', '_')
   return var.upper()
@@ -546,8 +562,9 @@
 pre, check = get_ir_prefix_from_ir_value_match(match)
 var = get_name_from_ir_value_match(match)
 for nameless_value in nameless_values:
-if nameless_value.check_prefix and re.match(r'^' + nameless_value.check_prefix + r'[0-9]+?$', var, re.IGNORECASE):
-warn("Change IR value name '%s' to prevent possible conflict with scripted FileCheck name." % (var,))
+if may_clash_with_default_check_prefix_name(nameless_value.check_prefix, var):
+  warn("Change IR value name '%s' or use -prefix-ir-filecheck-name to prevent possible conflict"
+" with scripted FileCheck name." % (var,))
 key = (var, get_check_key_from_ir_value_match(match))
 is_local_def = is_local_def_ir_value_match(match)
 if is_local_def and key in vars_seen:
Index: clang/test/utils/update_cc_test_checks/resolve-tmp-conflict.test
===
--- /dev/null
+++ clang/test/utils/update_cc_test_checks/resolve-tmp-conflict.test
@@ -0,0 +1,8 @@
+## Test that CHECK lines generated avoid naming conflicts with FileCheck IR variables
+
+# RUN: cp %S/Inputs/resolve-tmp-conflict.cpp %t.cpp && %update_cc_test_checks --function-signature --prefix-filecheck-ir-name _ %t.cpp
+# RUN: diff -u %S/Inputs/resolve-tmp-conflict.cpp.expected %t.cpp
+
+## Check that re-running update_cc_test_checks doesn't change the output
+# RUN: %update_cc_test_checks %t.cpp
+# RUN: diff -u %S/Inputs/resolve-tmp-conflict.cpp.expected %t.cpp
Index: clang/test/utils/update_cc_test_checks/Inputs/resolve-tmp-conflict.cpp.expected
===
--- /dev/null
+++ clang/test/utils/update_cc_test_checks/Inputs/resolve-tmp-conflict.cpp.expected
@@ -0,0 +1,25 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --function-signature --prefix-filecheck-ir-name _
+// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o - | FileCheck %s
+
+// CHECK-LABEL: define {{[^@]+}}@_Z3fooi
+// CHECK-SAME: (i32 [[A:%.*]]) #[[ATTR0:[0-9]+]] {
+// CHECK-NEXT:  entry:
+// 

[PATCH] D99415: [Utils] Add prefix parameter in update test checks to avoid FileCheck conflicts

2021-03-26 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis created this revision.
Herald added a subscriber: arichardson.
ggeorgakoudis requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D99415

Files:
  clang/test/utils/update_cc_test_checks/Inputs/resolve-tmp-conflict.cpp
  
clang/test/utils/update_cc_test_checks/Inputs/resolve-tmp-conflict.cpp.expected
  clang/test/utils/update_cc_test_checks/resolve-tmp-conflict.test
  llvm/utils/UpdateTestChecks/common.py

Index: llvm/utils/UpdateTestChecks/common.py
===
--- llvm/utils/UpdateTestChecks/common.py
+++ llvm/utils/UpdateTestChecks/common.py
@@ -16,6 +16,7 @@
 
 
 _verbose = False
+_prefix_filecheck_ir_name = ''
 
 def parse_commandline_args(parser):
   parser.add_argument('--include-generated-funcs', action='store_true',
@@ -32,6 +33,8 @@
   help='Deactivate CHECK line generation from this point forward')
   parser.add_argument('--replace-function-regex', nargs='+', default=[],
   help='List of regular expressions to replace matching function names')
+  parser.add_argument('--prefix-filecheck-ir-name', default='',
+  help='Add a prefix to FileCheck IR value names to avoid conflicts with scripted names')
   args = parser.parse_args()
   global _verbose
   _verbose = args.verbose
@@ -53,6 +56,9 @@
 self.argparse_callback = argparse_callback
 self.path = test
 self.args = args
+if args.prefix_filecheck_ir_name:
+  global _prefix_filecheck_ir_name
+  _prefix_filecheck_ir_name = args.prefix_filecheck_ir_name
 self.argv = argv
 self.input_lines = input_lines
 self.run_lines = find_run_lines(test, self.input_lines)
@@ -515,8 +521,15 @@
 # Create a FileCheck variable name based on an IR name.
 def get_value_name(var, check_prefix):
   var = var.replace('!', '')
+  # This is a nameless value, prepend check_prefix.
   if var.isdigit():
 var = check_prefix + var
+  else:
+# This is a named value that clashes with the check_prefix, prepend with _prefix_filecheck_ir_name,
+# if it has been defined.
+if check_prefix and re.match(r'^' + check_prefix + r'[0-9]+?$', var, re.IGNORECASE) \
+  and _prefix_filecheck_ir_name:
+  var = _prefix_filecheck_ir_name + var
   var = var.replace('.', '_')
   var = var.replace('-', '_')
   return var.upper()
@@ -546,8 +559,10 @@
 pre, check = get_ir_prefix_from_ir_value_match(match)
 var = get_name_from_ir_value_match(match)
 for nameless_value in nameless_values:
-if nameless_value.check_prefix and re.match(r'^' + nameless_value.check_prefix + r'[0-9]+?$', var, re.IGNORECASE):
-warn("Change IR value name '%s' to prevent possible conflict with scripted FileCheck name." % (var,))
+if nameless_value.check_prefix and re.match(r'^' + nameless_value.check_prefix + r'[0-9]+?$', var, re.IGNORECASE) \
+  and not _prefix_filecheck_ir_name:
+  warn("Change IR value name '%s' or use -prefix-ir-filecheck-name to prevent possible conflict"
+" with scripted FileCheck name." % (var,))
 key = (var, get_check_key_from_ir_value_match(match))
 is_local_def = is_local_def_ir_value_match(match)
 if is_local_def and key in vars_seen:
Index: clang/test/utils/update_cc_test_checks/resolve-tmp-conflict.test
===
--- /dev/null
+++ clang/test/utils/update_cc_test_checks/resolve-tmp-conflict.test
@@ -0,0 +1,8 @@
+## Test that CHECK lines generated avoid naming conflicts with FileCheck IR variables
+
+# RUN: cp %S/Inputs/resolve-tmp-conflict.cpp %t.cpp && %update_cc_test_checks --function-signature --prefix-filecheck-ir-name _ %t.cpp
+# RUN: diff -u %S/Inputs/resolve-tmp-conflict.cpp.expected %t.cpp
+
+## Check that re-running update_cc_test_checks doesn't change the output
+# RUN: %update_cc_test_checks %t.cpp
+# RUN: diff -u %S/Inputs/resolve-tmp-conflict.cpp.expected %t.cpp
Index: clang/test/utils/update_cc_test_checks/Inputs/resolve-tmp-conflict.cpp.expected
===
--- /dev/null
+++ clang/test/utils/update_cc_test_checks/Inputs/resolve-tmp-conflict.cpp.expected
@@ -0,0 +1,25 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --function-signature --prefix-filecheck-ir-name _
+// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o - | FileCheck %s
+
+// CHECK-LABEL: define {{[^@]+}}@_Z3fooi
+// CHECK-SAME: (i32 [[A:%.*]]) #[[ATTR0:[0-9]+]] {
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[A_ADDR:%.*]] = alloca i32, align 4
+// CHECK-NEXT:[[_TMP0:%.*]] = alloca i32*, align 8
+// CHECK-NEXT:[[_TMP1:%.*]] = alloca i32*, align 8
+// CHECK-NEXT:[[REF_TMP:%.*]] = alloca i32, align 4
+// CHECK-NEXT:store i32 [[A]], i32* 

[PATCH] D98712: [Utils] Support lit-like substitutions in update_cc_test_checks

2021-03-23 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis added inline comments.



Comment at: llvm/utils/update_cc_test_checks.py:228
+  '%t' : tempfile.NamedTemporaryFile().name,
+  '%S' : os.getcwd(),
+}

arichardson wrote:
> Shouldn't this be the directory containing the test? 
You are right, I will submit a patch soon.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98712

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


[PATCH] D98712: [Utils] Support lit-like substitutions in update_cc_test_checks

2021-03-16 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa80a33e8b553: [Utils] Support lit-like substitutions in 
update_cc_test_checks (authored by ggeorgakoudis).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98712

Files:
  clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c
  clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected
  llvm/utils/update_cc_test_checks.py


Index: llvm/utils/update_cc_test_checks.py
===
--- llvm/utils/update_cc_test_checks.py
+++ llvm/utils/update_cc_test_checks.py
@@ -176,7 +176,7 @@
   return args, parser
 
 
-def get_function_body(builder, args, filename, clang_args, extra_commands, 
+def get_function_body(builder, args, filename, clang_args, extra_commands,
   prefixes):
   # TODO Clean up duplication of asm/common build_function_body_dictionary
   # Invoke external tool and extract function bodies.
@@ -221,6 +221,13 @@
 # Build a list of clang command lines and check prefixes from RUN lines.
 run_list = []
 line2spell_and_mangled_list = collections.defaultdict(list)
+
+subs = {
+  '%s' : ti.path,
+  '%t' : tempfile.NamedTemporaryFile().name,
+  '%S' : os.getcwd(),
+}
+
 for l in ti.run_lines:
   commands = [cmd.strip() for cmd in l.split('|')]
 
@@ -234,15 +241,18 @@
   # Execute non-clang runline.
   if exec_args[0] not in SUBST:
 print('NOTE: Executing non-clang RUN line: ' + l, file=sys.stderr)
-# Replace %s by `filename`.
-exec_args = [i.replace('%s', ti.path) if '%s' in i else i for i in 
exec_args]
+# Do lit-like substitutions.
+for s in subs:
+  exec_args = [i.replace(s, subs[s]) if s in i else i for i in 
exec_args]
 exec_run_line(exec_args)
 continue
-  # This is a clang runline, apply %clang substitution rule, replace %s by 
`filename`,
+  # This is a clang runline, apply %clang substitution rule, do lit-like 
substitutions,
   # and append args.clang_args
   clang_args = exec_args
   clang_args[0:1] = SUBST[clang_args[0]]
-  clang_args = [i.replace('%s', ti.path) if '%s' in i else i for i in 
clang_args] + ti.args.clang_args
+  for s in subs:
+clang_args = [i.replace(s, subs[s]) if s in i else i for i in 
clang_args]
+  clang_args += ti.args.clang_args
 
   # Extract -check-prefix in FileCheck args
   filecheck_cmd = commands[-1]
@@ -271,7 +281,7 @@
   common.debug('Extracted clang cmd: clang {}'.format(clang_args))
   common.debug('Extracted FileCheck prefixes: {}'.format(prefixes))
 
-  get_function_body(builder, ti.args, ti.path, clang_args, extra_commands, 
+  get_function_body(builder, ti.args, ti.path, clang_args, extra_commands,
 prefixes)
 
   # Invoke clang -Xclang -ast-dump=json to get mapping from start lines to
@@ -315,7 +325,7 @@
  prefixes,
  func_dict, func)
 
-  common.add_checks_at_end(output_lines, run_list, builder.func_order(), 
+  common.add_checks_at_end(output_lines, run_list, builder.func_order(),
'//', lambda my_output_lines, prefixes, func:
check_generator(my_output_lines,
prefixes, func))
Index: 
clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected
===
--- clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected
+++ clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected
@@ -1,6 +1,7 @@
 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
 // Check that the non-clang/non-filechecked runlines execute
-// RUN: cp %s %s.copy.c
+// RUN: cp %s %S/Output/execute-all-runlines.copy.c
+// RUN: cp %S/Output/execute-all-runlines.copy.c %s.copy.c
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fopenmp %s.copy.c 
-emit-llvm-bc -o %t-host.bc
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fopenmp 
-fopenmp-host-ir-file-path %t-host.bc %s.copy.c -emit-llvm -o - | FileCheck %s
 
Index: clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c
===
--- clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c
+++ clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c
@@ -1,5 +1,6 @@
 // Check that the non-clang/non-filechecked runlines execute
-// RUN: cp %s %s.copy.c
+// RUN: cp %s %S/Output/execute-all-runlines.copy.c
+// RUN: cp %S/Output/execute-all-runlines.copy.c %s.copy.c
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu 

[PATCH] D98712: [Utils] Support lit-like substitutions in update_cc_test_checks

2021-03-16 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 331037.
ggeorgakoudis added a comment.

Update test


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98712

Files:
  clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c
  clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected
  llvm/utils/update_cc_test_checks.py


Index: llvm/utils/update_cc_test_checks.py
===
--- llvm/utils/update_cc_test_checks.py
+++ llvm/utils/update_cc_test_checks.py
@@ -176,7 +176,7 @@
   return args, parser
 
 
-def get_function_body(builder, args, filename, clang_args, extra_commands, 
+def get_function_body(builder, args, filename, clang_args, extra_commands,
   prefixes):
   # TODO Clean up duplication of asm/common build_function_body_dictionary
   # Invoke external tool and extract function bodies.
@@ -221,6 +221,13 @@
 # Build a list of clang command lines and check prefixes from RUN lines.
 run_list = []
 line2spell_and_mangled_list = collections.defaultdict(list)
+
+subs = {
+  '%s' : ti.path,
+  '%t' : tempfile.NamedTemporaryFile().name,
+  '%S' : os.getcwd(),
+}
+
 for l in ti.run_lines:
   commands = [cmd.strip() for cmd in l.split('|')]
 
@@ -234,15 +241,18 @@
   # Execute non-clang runline.
   if exec_args[0] not in SUBST:
 print('NOTE: Executing non-clang RUN line: ' + l, file=sys.stderr)
-# Replace %s by `filename`.
-exec_args = [i.replace('%s', ti.path) if '%s' in i else i for i in 
exec_args]
+# Do lit-like substitutions.
+for s in subs:
+  exec_args = [i.replace(s, subs[s]) if s in i else i for i in 
exec_args]
 exec_run_line(exec_args)
 continue
-  # This is a clang runline, apply %clang substitution rule, replace %s by 
`filename`,
+  # This is a clang runline, apply %clang substitution rule, do lit-like 
substitutions,
   # and append args.clang_args
   clang_args = exec_args
   clang_args[0:1] = SUBST[clang_args[0]]
-  clang_args = [i.replace('%s', ti.path) if '%s' in i else i for i in 
clang_args] + ti.args.clang_args
+  for s in subs:
+clang_args = [i.replace(s, subs[s]) if s in i else i for i in 
clang_args]
+  clang_args += ti.args.clang_args
 
   # Extract -check-prefix in FileCheck args
   filecheck_cmd = commands[-1]
@@ -271,7 +281,7 @@
   common.debug('Extracted clang cmd: clang {}'.format(clang_args))
   common.debug('Extracted FileCheck prefixes: {}'.format(prefixes))
 
-  get_function_body(builder, ti.args, ti.path, clang_args, extra_commands, 
+  get_function_body(builder, ti.args, ti.path, clang_args, extra_commands,
 prefixes)
 
   # Invoke clang -Xclang -ast-dump=json to get mapping from start lines to
@@ -315,7 +325,7 @@
  prefixes,
  func_dict, func)
 
-  common.add_checks_at_end(output_lines, run_list, builder.func_order(), 
+  common.add_checks_at_end(output_lines, run_list, builder.func_order(),
'//', lambda my_output_lines, prefixes, func:
check_generator(my_output_lines,
prefixes, func))
Index: 
clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected
===
--- clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected
+++ clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected
@@ -1,6 +1,7 @@
 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
 // Check that the non-clang/non-filechecked runlines execute
-// RUN: cp %s %s.copy.c
+// RUN: cp %s %S/Output/execute-all-runlines.copy.c
+// RUN: cp %S/Output/execute-all-runlines.copy.c %s.copy.c
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fopenmp %s.copy.c 
-emit-llvm-bc -o %t-host.bc
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fopenmp 
-fopenmp-host-ir-file-path %t-host.bc %s.copy.c -emit-llvm -o - | FileCheck %s
 
Index: clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c
===
--- clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c
+++ clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c
@@ -1,5 +1,6 @@
 // Check that the non-clang/non-filechecked runlines execute
-// RUN: cp %s %s.copy.c
+// RUN: cp %s %S/Output/execute-all-runlines.copy.c
+// RUN: cp %S/Output/execute-all-runlines.copy.c %s.copy.c
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fopenmp %s.copy.c 
-emit-llvm-bc -o %t-host.bc
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fopenmp 
-fopenmp-host-ir-file-path %t-host.bc %s.copy.c 

[PATCH] D98712: [Utils] Support lit-like substitutions in update_cc_test_checks

2021-03-16 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 331035.
ggeorgakoudis added a comment.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Add test


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98712

Files:
  clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c
  clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected
  llvm/utils/update_cc_test_checks.py


Index: llvm/utils/update_cc_test_checks.py
===
--- llvm/utils/update_cc_test_checks.py
+++ llvm/utils/update_cc_test_checks.py
@@ -176,7 +176,7 @@
   return args, parser
 
 
-def get_function_body(builder, args, filename, clang_args, extra_commands, 
+def get_function_body(builder, args, filename, clang_args, extra_commands,
   prefixes):
   # TODO Clean up duplication of asm/common build_function_body_dictionary
   # Invoke external tool and extract function bodies.
@@ -221,6 +221,13 @@
 # Build a list of clang command lines and check prefixes from RUN lines.
 run_list = []
 line2spell_and_mangled_list = collections.defaultdict(list)
+
+subs = {
+  '%s' : ti.path,
+  '%t' : tempfile.NamedTemporaryFile().name,
+  '%S' : os.getcwd(),
+}
+
 for l in ti.run_lines:
   commands = [cmd.strip() for cmd in l.split('|')]
 
@@ -234,15 +241,18 @@
   # Execute non-clang runline.
   if exec_args[0] not in SUBST:
 print('NOTE: Executing non-clang RUN line: ' + l, file=sys.stderr)
-# Replace %s by `filename`.
-exec_args = [i.replace('%s', ti.path) if '%s' in i else i for i in 
exec_args]
+# Do lit-like substitutions.
+for s in subs:
+  exec_args = [i.replace(s, subs[s]) if s in i else i for i in 
exec_args]
 exec_run_line(exec_args)
 continue
-  # This is a clang runline, apply %clang substitution rule, replace %s by 
`filename`,
+  # This is a clang runline, apply %clang substitution rule, do lit-like 
substitutions,
   # and append args.clang_args
   clang_args = exec_args
   clang_args[0:1] = SUBST[clang_args[0]]
-  clang_args = [i.replace('%s', ti.path) if '%s' in i else i for i in 
clang_args] + ti.args.clang_args
+  for s in subs:
+clang_args = [i.replace(s, subs[s]) if s in i else i for i in 
clang_args]
+  clang_args += ti.args.clang_args
 
   # Extract -check-prefix in FileCheck args
   filecheck_cmd = commands[-1]
@@ -271,7 +281,7 @@
   common.debug('Extracted clang cmd: clang {}'.format(clang_args))
   common.debug('Extracted FileCheck prefixes: {}'.format(prefixes))
 
-  get_function_body(builder, ti.args, ti.path, clang_args, extra_commands, 
+  get_function_body(builder, ti.args, ti.path, clang_args, extra_commands,
 prefixes)
 
   # Invoke clang -Xclang -ast-dump=json to get mapping from start lines to
@@ -315,7 +325,7 @@
  prefixes,
  func_dict, func)
 
-  common.add_checks_at_end(output_lines, run_list, builder.func_order(), 
+  common.add_checks_at_end(output_lines, run_list, builder.func_order(),
'//', lambda my_output_lines, prefixes, func:
check_generator(my_output_lines,
prefixes, func))
Index: 
clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected
===
--- clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected
+++ clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected
@@ -1,6 +1,7 @@
 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
 // Check that the non-clang/non-filechecked runlines execute
-// RUN: cp %s %s.copy.c
+// RUN: cp %s %S/Output/tmp.copy.c
+// RUN: cp %S/Output/tmp.copy.c %s.copy.c
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fopenmp %s.copy.c 
-emit-llvm-bc -o %t-host.bc
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fopenmp 
-fopenmp-host-ir-file-path %t-host.bc %s.copy.c -emit-llvm -o - | FileCheck %s
 
Index: clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c
===
--- clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c
+++ clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c
@@ -1,5 +1,6 @@
 // Check that the non-clang/non-filechecked runlines execute
-// RUN: cp %s %s.copy.c
+// RUN: cp %s %S/Output/tmp.copy.c
+// RUN: cp %S/Output/tmp.copy.c %s.copy.c
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fopenmp %s.copy.c 
-emit-llvm-bc -o %t-host.bc
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fopenmp 
-fopenmp-host-ir-file-path %t-host.bc %s.copy.c 

[PATCH] D91556: [OpenMPIRBuilder} Add capturing of parameters to pass to omp::parallel

2021-03-14 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis added a comment.

In D91556#2620928 , @jdoerfert wrote:

> In D91556#2617144 , 
> @kiranchandramohan wrote:
>
>> Ping @llitchev. Would you have time to take this forward?
>
> I think @ggeorgakoudis is working on an alternative API solution, we might 
> need to pick up the MLIR parts though.

Yes, I have a solution for OMPIRBuilder. It hinges on 
https://reviews.llvm.org/D96854 to use the CodeExtractor for building the 
aggregate.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91556

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


[PATCH] D97107: Replace func name with regex for update test scripts

2021-03-12 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1ce846be04f8: Replace func name with regex for update test 
scripts (authored by ggeorgakoudis).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97107

Files:
  clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c
  clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected
  clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
  llvm/utils/UpdateTestChecks/common.py
  llvm/utils/update_llc_test_checks.py

Index: llvm/utils/update_llc_test_checks.py
===
--- llvm/utils/update_llc_test_checks.py
+++ llvm/utils/update_llc_test_checks.py
@@ -109,7 +109,8 @@
 flags=type('', (object,), {
 'verbose': ti.args.verbose,
 'function_signature': False,
-'check_attributes': False}),
+'check_attributes': False,
+'replace_function_regex': []}),
 scrubber_args=[ti.args])
 
 for prefixes, llc_args, triple_in_cmd, march_in_cmd in run_list:
Index: llvm/utils/UpdateTestChecks/common.py
===
--- llvm/utils/UpdateTestChecks/common.py
+++ llvm/utils/UpdateTestChecks/common.py
@@ -30,6 +30,8 @@
help='Activate CHECK line generation from this point forward')
   parser.add_argument('--disable', action='store_false', dest='enabled',
   help='Deactivate CHECK line generation from this point forward')
+  parser.add_argument('--replace-function-regex', nargs='+', default=[],
+  help='List of regular expressions to replace matching function names')
   args = parser.parse_args()
   global _verbose
   _verbose = args.verbose
@@ -275,6 +277,8 @@
 self._record_args = flags.function_signature
 self._check_attributes = flags.check_attributes
 self._scrubber_args = scrubber_args
+# Strip double-quotes if input was read by UTC_ARGS
+self._replace_function_regex = list(map(lambda x: x.strip('"'), flags.replace_function_regex))
 self._func_dict = {}
 self._func_order = {}
 self._global_var_dict = {}
@@ -348,6 +352,30 @@
   self._func_dict[prefix][func] = None
   continue
 
+# Replace function names matching the regex.
+for regex in self._replace_function_regex:
+  # Pattern that matches capture groups in the regex in leftmost order.
+  group_regex = re.compile('\(.*?\)')
+  # Replace function name with regex.
+  match = re.match(regex, func)
+  if match:
+func_repl = regex
+# Replace any capture groups with their matched strings.
+for g in match.groups():
+  func_repl = group_regex.sub(g, func_repl, count=1)
+func = '{{' + func_repl + '}}'
+
+  # Replace all calls to regex matching functions.
+  matches = re.finditer(regex, scrubbed_body)
+  for match in matches:
+func_repl = regex
+# Replace any capture groups with their matched strings.
+for g in match.groups():
+func_repl = group_regex.sub(g, func_repl, count=1)
+# Substitute function call names that match the regex with the same
+# capture groups set.
+scrubbed_body = re.sub(func_repl, '{{' + func_repl + '}}', scrubbed_body)
+
 self._func_dict[prefix][func] = function_body(
 scrubbed_body, scrubbed_extra, args_and_sig, attrs)
 self._func_order[prefix].append(func)
@@ -794,6 +822,8 @@
   continue  # Don't add default values
 autogenerated_note_args += action.option_strings[0] + ' '
 if action.const is None:  # action takes a parameter
+  if action.nargs == '+':
+value = ' '.join(map(lambda v: '"' + v.strip('"') + '"', value))
   autogenerated_note_args += '%s ' % value
   if autogenerated_note_args:
 autogenerated_note_args = ' %s %s' % (UTC_ARGS_KEY, autogenerated_note_args[:-1])
Index: clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
===
--- /dev/null
+++ clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
@@ -0,0 +1,9 @@
+## Test that CHECK lines are generated for clang-generated functions replaced
+## by regex
+
+## RUN: cp %S/Inputs/generated-funcs-regex.c %t-generated-funcs-regex.c && %update_cc_test_checks --include-generated-funcs --replace-function-regex "__([a-z]+)_offloading_[a-z0-9]+_[a-z0-9]+_(.*)_l[0-9]+" -- %t-generated-funcs-regex.c
+# RUN: diff -u %S/Inputs/generated-funcs-regex.c.expected %t-generated-funcs-regex.c
+
+## Check that re-running update_cc_test_checks doesn't change the output
+# RUN: 

[PATCH] D97107: Replace func name with regex for update test scripts

2021-03-12 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 330407.
ggeorgakoudis added a comment.

Fix for upstreaming


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97107

Files:
  clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c
  clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected
  clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
  llvm/utils/UpdateTestChecks/common.py
  llvm/utils/update_llc_test_checks.py

Index: llvm/utils/update_llc_test_checks.py
===
--- llvm/utils/update_llc_test_checks.py
+++ llvm/utils/update_llc_test_checks.py
@@ -109,7 +109,8 @@
 flags=type('', (object,), {
 'verbose': ti.args.verbose,
 'function_signature': False,
-'check_attributes': False}),
+'check_attributes': False,
+'replace_function_regex': []}),
 scrubber_args=[ti.args])
 
 for prefixes, llc_args, triple_in_cmd, march_in_cmd in run_list:
Index: llvm/utils/UpdateTestChecks/common.py
===
--- llvm/utils/UpdateTestChecks/common.py
+++ llvm/utils/UpdateTestChecks/common.py
@@ -30,6 +30,8 @@
help='Activate CHECK line generation from this point forward')
   parser.add_argument('--disable', action='store_false', dest='enabled',
   help='Deactivate CHECK line generation from this point forward')
+  parser.add_argument('--replace-function-regex', nargs='+', default=[],
+  help='List of regular expressions to replace matching function names')
   args = parser.parse_args()
   global _verbose
   _verbose = args.verbose
@@ -275,6 +277,8 @@
 self._record_args = flags.function_signature
 self._check_attributes = flags.check_attributes
 self._scrubber_args = scrubber_args
+# Strip double-quotes if input was read by UTC_ARGS
+self._replace_function_regex = list(map(lambda x: x.strip('"'), flags.replace_function_regex))
 self._func_dict = {}
 self._func_order = {}
 self._global_var_dict = {}
@@ -348,6 +352,30 @@
   self._func_dict[prefix][func] = None
   continue
 
+# Replace function names matching the regex.
+for regex in self._replace_function_regex:
+  # Pattern that matches capture groups in the regex in leftmost order.
+  group_regex = re.compile('\(.*?\)')
+  # Replace function name with regex.
+  match = re.match(regex, func)
+  if match:
+func_repl = regex
+# Replace any capture groups with their matched strings.
+for g in match.groups():
+  func_repl = group_regex.sub(g, func_repl, count=1)
+func = '{{' + func_repl + '}}'
+
+  # Replace all calls to regex matching functions.
+  matches = re.finditer(regex, scrubbed_body)
+  for match in matches:
+func_repl = regex
+# Replace any capture groups with their matched strings.
+for g in match.groups():
+func_repl = group_regex.sub(g, func_repl, count=1)
+# Substitute function call names that match the regex with the same
+# capture groups set.
+scrubbed_body = re.sub(func_repl, '{{' + func_repl + '}}', scrubbed_body)
+
 self._func_dict[prefix][func] = function_body(
 scrubbed_body, scrubbed_extra, args_and_sig, attrs)
 self._func_order[prefix].append(func)
@@ -794,6 +822,8 @@
   continue  # Don't add default values
 autogenerated_note_args += action.option_strings[0] + ' '
 if action.const is None:  # action takes a parameter
+  if action.nargs == '+':
+value = ' '.join(map(lambda v: '"' + v.strip('"') + '"', value))
   autogenerated_note_args += '%s ' % value
   if autogenerated_note_args:
 autogenerated_note_args = ' %s %s' % (UTC_ARGS_KEY, autogenerated_note_args[:-1])
Index: clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
===
--- /dev/null
+++ clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
@@ -0,0 +1,9 @@
+## Test that CHECK lines are generated for clang-generated functions replaced
+## by regex
+
+## RUN: cp %S/Inputs/generated-funcs-regex.c %t-generated-funcs-regex.c && %update_cc_test_checks --include-generated-funcs --replace-function-regex "__([a-z]+)_offloading_[a-z0-9]+_[a-z0-9]+_(.*)_l[0-9]+" -- %t-generated-funcs-regex.c
+# RUN: diff -u %S/Inputs/generated-funcs-regex.c.expected %t-generated-funcs-regex.c
+
+## Check that re-running update_cc_test_checks doesn't change the output
+# RUN: %update_cc_test_checks %t-generated-funcs-regex.c
+# RUN: diff -u %S/Inputs/generated-funcs-regex.c.expected %t-generated-funcs-regex.c
Index: 

[PATCH] D97107: Replace func name with regex for update test scripts

2021-03-12 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5eaf70afb5f8: Replace func name with regex for update test 
scripts (authored by ggeorgakoudis).

Changed prior to commit:
  https://reviews.llvm.org/D97107?vs=330399=330402#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97107

Files:
  clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c
  clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected
  clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
  llvm/utils/UpdateTestChecks/common.py
  llvm/utils/update_llc_test_checks.py

Index: llvm/utils/update_llc_test_checks.py
===
--- llvm/utils/update_llc_test_checks.py
+++ llvm/utils/update_llc_test_checks.py
@@ -109,7 +109,8 @@
 flags=type('', (object,), {
 'verbose': ti.args.verbose,
 'function_signature': False,
-'check_attributes': False}),
+'check_attributes': False,
+'replace_function_regex': []}),
 scrubber_args=[ti.args])
 
 for prefixes, llc_args, triple_in_cmd, march_in_cmd in run_list:
Index: llvm/utils/UpdateTestChecks/common.py
===
--- llvm/utils/UpdateTestChecks/common.py
+++ llvm/utils/UpdateTestChecks/common.py
@@ -30,6 +30,8 @@
help='Activate CHECK line generation from this point forward')
   parser.add_argument('--disable', action='store_false', dest='enabled',
   help='Deactivate CHECK line generation from this point forward')
+  parser.add_argument('--replace-function-regex', nargs='+', default=[],
+  help='List of regular expressions to replace matching function names')
   args = parser.parse_args()
   global _verbose
   _verbose = args.verbose
@@ -275,6 +277,8 @@
 self._record_args = flags.function_signature
 self._check_attributes = flags.check_attributes
 self._scrubber_args = scrubber_args
+# Strip double-quotes if input was read by UTC_ARGS
+self._replace_function_regex = list(map(lambda x: x.strip('"'), flags.replace_function_regex))
 self._func_dict = {}
 self._func_order = {}
 self._global_var_dict = {}
@@ -348,6 +352,30 @@
   self._func_dict[prefix][func] = None
   continue
 
+# Replace function names matching the regex.
+for regex in self._replace_function_regex:
+  # Pattern that matches capture groups in the regex in leftmost order.
+  group_regex = re.compile('\(.*?\)')
+  # Replace function name with regex.
+  match = re.match(regex, func)
+  if match:
+func_repl = regex
+# Replace any capture groups with their matched strings.
+for g in match.groups():
+  func_repl = group_regex.sub(g, func_repl, count=1)
+func = '{{' + func_repl + '}}'
+
+  # Replace all calls to regex matching functions.
+  matches = re.finditer(regex, scrubbed_body)
+  for match in matches:
+func_repl = regex
+# Replace any capture groups with their matched strings.
+for g in match.groups():
+func_repl = group_regex.sub(g, func_repl, count=1)
+# Substitute function call names that match the regex with the same
+# capture groups set.
+scrubbed_body = re.sub(func_repl, '{{' + func_repl + '}}', scrubbed_body)
+
 self._func_dict[prefix][func] = function_body(
 scrubbed_body, scrubbed_extra, args_and_sig, attrs)
 self._func_order[prefix].append(func)
@@ -794,6 +822,8 @@
   continue  # Don't add default values
 autogenerated_note_args += action.option_strings[0] + ' '
 if action.const is None:  # action takes a parameter
+  if action.nargs == '+':
+value = ' '.join(map(lambda v: '"' + v.strip('"') + '"', value))
   autogenerated_note_args += '%s ' % value
   if autogenerated_note_args:
 autogenerated_note_args = ' %s %s' % (UTC_ARGS_KEY, autogenerated_note_args[:-1])
Index: clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
===
--- /dev/null
+++ clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
@@ -0,0 +1,9 @@
+## Test that CHECK lines are generated for clang-generated functions replaced
+## by regex
+
+## RUN: cp %S/Inputs/generated-funcs-regex.c %t-generated-funcs-regex.c && %update_cc_test_checks --include-generated-funcs --replace-function-regex "__([a-z]+)_offloading_[a-z0-9]+_[a-z0-9]+_(.*)_l[0-9]+" -- %t-generated-funcs-regex.c
+# RUN: diff -u %S/Inputs/generated-funcs-regex.c.expected %t-generated-funcs-regex.c
+
+## 

[PATCH] D97107: Replace func name with regex in update_cc_test_checks

2021-03-12 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 330399.
ggeorgakoudis added a comment.

NFC change in update_llc_test_checks for compatibility


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97107

Files:
  clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c
  clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected
  clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
  llvm/utils/UpdateTestChecks/common.py
  llvm/utils/update_llc_test_checks.py

Index: llvm/utils/update_llc_test_checks.py
===
--- llvm/utils/update_llc_test_checks.py
+++ llvm/utils/update_llc_test_checks.py
@@ -109,7 +109,8 @@
 flags=type('', (object,), {
 'verbose': ti.args.verbose,
 'function_signature': False,
-'check_attributes': False}),
+'check_attributes': False,
+'replace_function_regex': []}),
 scrubber_args=[ti.args])
 
 for prefixes, llc_args, triple_in_cmd, march_in_cmd in run_list:
Index: llvm/utils/UpdateTestChecks/common.py
===
--- llvm/utils/UpdateTestChecks/common.py
+++ llvm/utils/UpdateTestChecks/common.py
@@ -30,6 +30,8 @@
help='Activate CHECK line generation from this point forward')
   parser.add_argument('--disable', action='store_false', dest='enabled',
   help='Deactivate CHECK line generation from this point forward')
+  parser.add_argument('--replace-function-regex', nargs='+', default=[],
+  help='List of regular expressions to replace matching function names')
   args = parser.parse_args()
   global _verbose
   _verbose = args.verbose
@@ -264,6 +266,8 @@
 self._record_args = flags.function_signature
 self._check_attributes = flags.check_attributes
 self._scrubber_args = scrubber_args
+# Strip double-quotes if input was read by UTC_ARGS
+self._replace_function_regex = list(map(lambda x: x.strip('"'), flags.replace_function_regex))
 self._func_dict = {}
 self._func_order = {}
 for tuple in run_list:
@@ -331,6 +335,30 @@
   self._func_dict[prefix][func] = None
   continue
 
+# Replace function names matching the regex.
+for regex in self._replace_function_regex:
+  # Pattern that matches capture groups in the regex in leftmost order.
+  group_regex = re.compile('\(.*?\)')
+  # Replace function name with regex.
+  match = re.match(regex, func)
+  if match:
+func_repl = regex
+# Replace any capture groups with their matched strings.
+for g in match.groups():
+  func_repl = group_regex.sub(g, func_repl, count=1)
+func = '{{' + func_repl + '}}'
+
+  # Replace all calls to regex matching functions.
+  matches = re.finditer(regex, scrubbed_body)
+  for match in matches:
+func_repl = regex
+# Replace any capture groups with their matched strings.
+for g in match.groups():
+func_repl = group_regex.sub(g, func_repl, count=1)
+# Substitute function call names that match the regex with the same
+# capture groups set.
+scrubbed_body = re.sub(func_repl, '{{' + func_repl + '}}', scrubbed_body)
+
 self._func_dict[prefix][func] = function_body(
 scrubbed_body, scrubbed_extra, args_and_sig, attrs)
 self._func_order[prefix].append(func)
@@ -633,6 +661,8 @@
   continue  # Don't add default values
 autogenerated_note_args += action.option_strings[0] + ' '
 if action.const is None:  # action takes a parameter
+  if action.nargs == '+':
+value = ' '.join(map(lambda v: '"' + v.strip('"') + '"', value))
   autogenerated_note_args += '%s ' % value
   if autogenerated_note_args:
 autogenerated_note_args = ' %s %s' % (UTC_ARGS_KEY, autogenerated_note_args[:-1])
Index: clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
===
--- /dev/null
+++ clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
@@ -0,0 +1,9 @@
+## Test that CHECK lines are generated for clang-generated functions replaced
+## by regex
+
+## RUN: cp %S/Inputs/generated-funcs-regex.c %t-generated-funcs-regex.c && %update_cc_test_checks --include-generated-funcs --replace-function-regex "__([a-z]+)_offloading_[a-z0-9]+_[a-z0-9]+_(.*)_l[0-9]+" -- %t-generated-funcs-regex.c
+# RUN: diff -u %S/Inputs/generated-funcs-regex.c.expected %t-generated-funcs-regex.c
+
+## Check that re-running update_cc_test_checks doesn't change the output
+# RUN: %update_cc_test_checks %t-generated-funcs-regex.c
+# RUN: diff -u %S/Inputs/generated-funcs-regex.c.expected 

[PATCH] D97068: Run non-filechecked commands in update_cc_test_checks.py

2021-03-10 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis added a comment.

In D97068#2617751 , @jroelofs wrote:

> In D97068#2617642 , @ggeorgakoudis 
> wrote:
>
>> Add triple to avoid spurious failures in tests
>
> They're not really spurious, right... Doesn't this mean that 
> `utils/update_cc_test_checks.py` is now broken for people who develop on a 
> mac?

It's spurious in the sense that it's not this commit that breaks mac tests. 
Testing on mac is already broken. By investigating the issue, you are right 
that the USER_LABEL_PREFIX `_` is skipping generating the checks because 
function names mismatch in IR output. I suppose the issue should be fixed by 
identifying a mac triple and removing the `_` prefix?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97068

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


[PATCH] D97107: Replace func name with regex in update_cc_test_checks

2021-03-10 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis added a comment.

In D97107#2617897 , @thakis wrote:

> This breaks check-llvm on linux and mac:
> http://45.33.8.238/linux/41398/step_12.txt
> http://45.33.8.238/macm1/5291/step_10.txt
> http://lab.llvm.org:8011/#/builders/109
> (and on my local build too)
>
> Please take a look, and please revert for now if it takes a while to fix.

Reverted, I'm going to test better, fix and re-land.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97107

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


[PATCH] D97107: Replace func name with regex in update_cc_test_checks

2021-03-10 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbf58d6a1f922: Replace func name with regex in 
update_cc_test_checks (authored by ggeorgakoudis).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97107

Files:
  clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c
  clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected
  clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
  llvm/utils/UpdateTestChecks/common.py

Index: llvm/utils/UpdateTestChecks/common.py
===
--- llvm/utils/UpdateTestChecks/common.py
+++ llvm/utils/UpdateTestChecks/common.py
@@ -30,6 +30,8 @@
help='Activate CHECK line generation from this point forward')
   parser.add_argument('--disable', action='store_false', dest='enabled',
   help='Deactivate CHECK line generation from this point forward')
+  parser.add_argument('--replace-function-regex', nargs='+', default=[],
+  help='List of regular expressions to replace matching function names')
   args = parser.parse_args()
   global _verbose
   _verbose = args.verbose
@@ -264,6 +266,8 @@
 self._record_args = flags.function_signature
 self._check_attributes = flags.check_attributes
 self._scrubber_args = scrubber_args
+# Strip double-quotes if input was read by UTC_ARGS
+self._replace_function_regex = list(map(lambda x: x.strip('"'), flags.replace_function_regex))
 self._func_dict = {}
 self._func_order = {}
 for tuple in run_list:
@@ -331,6 +335,30 @@
   self._func_dict[prefix][func] = None
   continue
 
+# Replace function names matching the regex.
+for regex in self._replace_function_regex:
+  # Pattern that matches capture groups in the regex in leftmost order.
+  group_regex = re.compile('\(.*?\)')
+  # Replace function name with regex.
+  match = re.match(regex, func)
+  if match:
+func_repl = regex
+# Replace any capture groups with their matched strings.
+for g in match.groups():
+  func_repl = group_regex.sub(g, func_repl, count=1)
+func = '{{' + func_repl + '}}'
+
+  # Replace all calls to regex matching functions.
+  matches = re.finditer(regex, scrubbed_body)
+  for match in matches:
+func_repl = regex
+# Replace any capture groups with their matched strings.
+for g in match.groups():
+func_repl = group_regex.sub(g, func_repl, count=1)
+# Substitute function call names that match the regex with the same
+# capture groups set.
+scrubbed_body = re.sub(func_repl, '{{' + func_repl + '}}', scrubbed_body)
+
 self._func_dict[prefix][func] = function_body(
 scrubbed_body, scrubbed_extra, args_and_sig, attrs)
 self._func_order[prefix].append(func)
@@ -633,6 +661,8 @@
   continue  # Don't add default values
 autogenerated_note_args += action.option_strings[0] + ' '
 if action.const is None:  # action takes a parameter
+  if action.nargs == '+':
+value = ' '.join(map(lambda v: '"' + v.strip('"') + '"', value))
   autogenerated_note_args += '%s ' % value
   if autogenerated_note_args:
 autogenerated_note_args = ' %s %s' % (UTC_ARGS_KEY, autogenerated_note_args[:-1])
Index: clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
===
--- /dev/null
+++ clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
@@ -0,0 +1,9 @@
+## Test that CHECK lines are generated for clang-generated functions replaced
+## by regex
+
+## RUN: cp %S/Inputs/generated-funcs-regex.c %t-generated-funcs-regex.c && %update_cc_test_checks --include-generated-funcs --replace-function-regex "__([a-z]+)_offloading_[a-z0-9]+_[a-z0-9]+_(.*)_l[0-9]+" -- %t-generated-funcs-regex.c
+# RUN: diff -u %S/Inputs/generated-funcs-regex.c.expected %t-generated-funcs-regex.c
+
+## Check that re-running update_cc_test_checks doesn't change the output
+# RUN: %update_cc_test_checks %t-generated-funcs-regex.c
+# RUN: diff -u %S/Inputs/generated-funcs-regex.c.expected %t-generated-funcs-regex.c
Index: clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected
===
--- /dev/null
+++ clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected
@@ -0,0 +1,36 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --include-generated-funcs --replace-function-regex "__([a-z]+)_offloading_[a-z0-9]+_[a-z0-9]+_(.*)_l[0-9]+"
+// RUN: 

[PATCH] D97107: Replace func name with regex in update_cc_test_checks

2021-03-10 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 329747.
ggeorgakoudis added a comment.

Add triple in test to avoid spurious failures


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97107

Files:
  clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c
  clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected
  clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
  llvm/utils/UpdateTestChecks/common.py

Index: llvm/utils/UpdateTestChecks/common.py
===
--- llvm/utils/UpdateTestChecks/common.py
+++ llvm/utils/UpdateTestChecks/common.py
@@ -30,6 +30,8 @@
help='Activate CHECK line generation from this point forward')
   parser.add_argument('--disable', action='store_false', dest='enabled',
   help='Deactivate CHECK line generation from this point forward')
+  parser.add_argument('--replace-function-regex', nargs='+', default=[],
+  help='List of regular expressions to replace matching function names')
   args = parser.parse_args()
   global _verbose
   _verbose = args.verbose
@@ -264,6 +266,8 @@
 self._record_args = flags.function_signature
 self._check_attributes = flags.check_attributes
 self._scrubber_args = scrubber_args
+# Strip double-quotes if input was read by UTC_ARGS
+self._replace_function_regex = list(map(lambda x: x.strip('"'), flags.replace_function_regex))
 self._func_dict = {}
 self._func_order = {}
 for tuple in run_list:
@@ -331,6 +335,30 @@
   self._func_dict[prefix][func] = None
   continue
 
+# Replace function names matching the regex.
+for regex in self._replace_function_regex:
+  # Pattern that matches capture groups in the regex in leftmost order.
+  group_regex = re.compile('\(.*?\)')
+  # Replace function name with regex.
+  match = re.match(regex, func)
+  if match:
+func_repl = regex
+# Replace any capture groups with their matched strings.
+for g in match.groups():
+  func_repl = group_regex.sub(g, func_repl, count=1)
+func = '{{' + func_repl + '}}'
+
+  # Replace all calls to regex matching functions.
+  matches = re.finditer(regex, scrubbed_body)
+  for match in matches:
+func_repl = regex
+# Replace any capture groups with their matched strings.
+for g in match.groups():
+func_repl = group_regex.sub(g, func_repl, count=1)
+# Substitute function call names that match the regex with the same
+# capture groups set.
+scrubbed_body = re.sub(func_repl, '{{' + func_repl + '}}', scrubbed_body)
+
 self._func_dict[prefix][func] = function_body(
 scrubbed_body, scrubbed_extra, args_and_sig, attrs)
 self._func_order[prefix].append(func)
@@ -633,6 +661,8 @@
   continue  # Don't add default values
 autogenerated_note_args += action.option_strings[0] + ' '
 if action.const is None:  # action takes a parameter
+  if action.nargs == '+':
+value = ' '.join(map(lambda v: '"' + v.strip('"') + '"', value))
   autogenerated_note_args += '%s ' % value
   if autogenerated_note_args:
 autogenerated_note_args = ' %s %s' % (UTC_ARGS_KEY, autogenerated_note_args[:-1])
Index: clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
===
--- /dev/null
+++ clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
@@ -0,0 +1,9 @@
+## Test that CHECK lines are generated for clang-generated functions replaced
+## by regex
+
+## RUN: cp %S/Inputs/generated-funcs-regex.c %t-generated-funcs-regex.c && %update_cc_test_checks --include-generated-funcs --replace-function-regex "__([a-z]+)_offloading_[a-z0-9]+_[a-z0-9]+_(.*)_l[0-9]+" -- %t-generated-funcs-regex.c
+# RUN: diff -u %S/Inputs/generated-funcs-regex.c.expected %t-generated-funcs-regex.c
+
+## Check that re-running update_cc_test_checks doesn't change the output
+# RUN: %update_cc_test_checks %t-generated-funcs-regex.c
+# RUN: diff -u %S/Inputs/generated-funcs-regex.c.expected %t-generated-funcs-regex.c
Index: clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected
===
--- /dev/null
+++ clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected
@@ -0,0 +1,36 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --include-generated-funcs --replace-function-regex "__([a-z]+)_offloading_[a-z0-9]+_[a-z0-9]+_(.*)_l[0-9]+"
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fopenmp %s -emit-llvm -o - | FileCheck %s
+
+void 

[PATCH] D97068: Run non-filechecked commands in update_cc_test_checks.py

2021-03-10 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa2abe2259c2d: Run non-filechecked commands in 
update_cc_test_checks.py (authored by ggeorgakoudis).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97068

Files:
  clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c
  clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected
  clang/test/utils/update_cc_test_checks/exec-all-runlines.test
  llvm/utils/update_cc_test_checks.py

Index: llvm/utils/update_cc_test_checks.py
===
--- llvm/utils/update_cc_test_checks.py
+++ llvm/utils/update_cc_test_checks.py
@@ -203,6 +203,14 @@
   'are discouraged in Clang testsuite.', file=sys.stderr)
 sys.exit(1)
 
+def exec_run_line(exe):
+  popen = subprocess.Popen(exe, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
+  stdout, stderr = popen.communicate()
+  if popen.returncode != 0:
+sys.stderr.write('Failed to run ' + ' '.join(exe) + '\n')
+sys.stderr.write(stderr)
+sys.stderr.write(stdout)
+sys.exit(3)
 
 def main():
   initial_args, parser = config()
@@ -221,25 +229,31 @@
   if m:
 triple_in_cmd = m.groups()[0]
 
-  # Apply %clang substitution rule, replace %s by `filename`, and append args.clang_args
-  clang_args = shlex.split(commands[0])
-  if clang_args[0] not in SUBST:
-print('WARNING: Skipping non-clang RUN line: ' + l, file=sys.stderr)
+  # Parse executable args.
+  exec_args = shlex.split(commands[0])
+  # Execute non-clang runline.
+  if exec_args[0] not in SUBST:
+print('NOTE: Executing non-clang RUN line: ' + l, file=sys.stderr)
+# Replace %s by `filename`.
+exec_args = [i.replace('%s', ti.path) if '%s' in i else i for i in exec_args]
+exec_run_line(exec_args)
 continue
+  # This is a clang runline, apply %clang substitution rule, replace %s by `filename`,
+  # and append args.clang_args
+  clang_args = exec_args
   clang_args[0:1] = SUBST[clang_args[0]]
-  clang_args = [ti.path if i == '%s' else i for i in clang_args] + ti.args.clang_args
-
-  # Permit piping the output through opt
-  if not (len(commands) == 2 or
-  (len(commands) == 3 and commands[1].startswith('opt'))):
-print('WARNING: Skipping non-clang RUN line: ' + l, file=sys.stderr)
+  clang_args = [i.replace('%s', ti.path) if '%s' in i else i for i in clang_args] + ti.args.clang_args
 
   # Extract -check-prefix in FileCheck args
   filecheck_cmd = commands[-1]
   common.verify_filecheck_prefixes(filecheck_cmd)
   if not filecheck_cmd.startswith('FileCheck '):
-print('WARNING: Skipping non-FileChecked RUN line: ' + l, file=sys.stderr)
+print('NOTE: Executing non-FileChecked clang RUN line: ' + l, file=sys.stderr)
+# Execute non-filechecked clang runline.
+exe = [ti.args.clang] + clang_args
+exec_run_line(exe)
 continue
+
   check_prefixes = [item for m in common.CHECK_PREFIX_RE.finditer(filecheck_cmd)
for item in m.group(1).split(',')]
   if not check_prefixes:
Index: clang/test/utils/update_cc_test_checks/exec-all-runlines.test
===
--- /dev/null
+++ clang/test/utils/update_cc_test_checks/exec-all-runlines.test
@@ -0,0 +1,8 @@
+## Test that non-clang/non-filechecked runlines execute
+
+# RUN: cp %S/Inputs/exec-all-runlines.c %t-generated.c && %update_cc_test_checks %t-generated.c
+# RUN: diff -u %S/Inputs/exec-all-runlines.c.expected %t-generated.c
+
+## Check that re-running update_cc_test_checks doesn't change the output
+# RUN: %update_cc_test_checks %t-generated.c
+# RUN: diff -u %S/Inputs/exec-all-runlines.c.expected %t-generated.c
Index: clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected
===
--- /dev/null
+++ clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected
@@ -0,0 +1,17 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
+// Check that the non-clang/non-filechecked runlines execute
+// RUN: cp %s %s.copy.c
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fopenmp %s.copy.c -emit-llvm-bc -o %t-host.bc
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fopenmp -fopenmp-host-ir-file-path %t-host.bc %s.copy.c -emit-llvm -o - | FileCheck %s
+
+void use(int);
+
+// CHECK-LABEL: @test(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[A_ADDR:%.*]] = alloca i32, align 4
+// CHECK-NEXT:store i32 [[A:%.*]], i32* [[A_ADDR]], align 4
+// CHECK-NEXT:ret void
+//
+void test(int a)
+{
+}
Index: 

[PATCH] D97068: Run non-filechecked commands in update_cc_test_checks.py

2021-03-10 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 329734.
ggeorgakoudis added a comment.

Add triple to avoid spurious failures in tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97068

Files:
  clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c
  clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected
  clang/test/utils/update_cc_test_checks/exec-all-runlines.test
  llvm/utils/update_cc_test_checks.py

Index: llvm/utils/update_cc_test_checks.py
===
--- llvm/utils/update_cc_test_checks.py
+++ llvm/utils/update_cc_test_checks.py
@@ -203,6 +203,14 @@
   'are discouraged in Clang testsuite.', file=sys.stderr)
 sys.exit(1)
 
+def exec_run_line(exe):
+  popen = subprocess.Popen(exe, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
+  stdout, stderr = popen.communicate()
+  if popen.returncode != 0:
+sys.stderr.write('Failed to run ' + ' '.join(exe) + '\n')
+sys.stderr.write(stderr)
+sys.stderr.write(stdout)
+sys.exit(3)
 
 def main():
   initial_args, parser = config()
@@ -221,25 +229,31 @@
   if m:
 triple_in_cmd = m.groups()[0]
 
-  # Apply %clang substitution rule, replace %s by `filename`, and append args.clang_args
-  clang_args = shlex.split(commands[0])
-  if clang_args[0] not in SUBST:
-print('WARNING: Skipping non-clang RUN line: ' + l, file=sys.stderr)
+  # Parse executable args.
+  exec_args = shlex.split(commands[0])
+  # Execute non-clang runline.
+  if exec_args[0] not in SUBST:
+print('NOTE: Executing non-clang RUN line: ' + l, file=sys.stderr)
+# Replace %s by `filename`.
+exec_args = [i.replace('%s', ti.path) if '%s' in i else i for i in exec_args]
+exec_run_line(exec_args)
 continue
+  # This is a clang runline, apply %clang substitution rule, replace %s by `filename`,
+  # and append args.clang_args
+  clang_args = exec_args
   clang_args[0:1] = SUBST[clang_args[0]]
-  clang_args = [ti.path if i == '%s' else i for i in clang_args] + ti.args.clang_args
-
-  # Permit piping the output through opt
-  if not (len(commands) == 2 or
-  (len(commands) == 3 and commands[1].startswith('opt'))):
-print('WARNING: Skipping non-clang RUN line: ' + l, file=sys.stderr)
+  clang_args = [i.replace('%s', ti.path) if '%s' in i else i for i in clang_args] + ti.args.clang_args
 
   # Extract -check-prefix in FileCheck args
   filecheck_cmd = commands[-1]
   common.verify_filecheck_prefixes(filecheck_cmd)
   if not filecheck_cmd.startswith('FileCheck '):
-print('WARNING: Skipping non-FileChecked RUN line: ' + l, file=sys.stderr)
+print('NOTE: Executing non-FileChecked clang RUN line: ' + l, file=sys.stderr)
+# Execute non-filechecked clang runline.
+exe = [ti.args.clang] + clang_args
+exec_run_line(exe)
 continue
+
   check_prefixes = [item for m in common.CHECK_PREFIX_RE.finditer(filecheck_cmd)
for item in m.group(1).split(',')]
   if not check_prefixes:
Index: clang/test/utils/update_cc_test_checks/exec-all-runlines.test
===
--- /dev/null
+++ clang/test/utils/update_cc_test_checks/exec-all-runlines.test
@@ -0,0 +1,8 @@
+## Test that non-clang/non-filechecked runlines execute
+
+# RUN: cp %S/Inputs/exec-all-runlines.c %t-generated.c && %update_cc_test_checks %t-generated.c
+# RUN: diff -u %S/Inputs/exec-all-runlines.c.expected %t-generated.c
+
+## Check that re-running update_cc_test_checks doesn't change the output
+# RUN: %update_cc_test_checks %t-generated.c
+# RUN: diff -u %S/Inputs/exec-all-runlines.c.expected %t-generated.c
Index: clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected
===
--- /dev/null
+++ clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected
@@ -0,0 +1,17 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
+// Check that the non-clang/non-filechecked runlines execute
+// RUN: cp %s %s.copy.c
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fopenmp %s.copy.c -emit-llvm-bc -o %t-host.bc
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fopenmp -fopenmp-host-ir-file-path %t-host.bc %s.copy.c -emit-llvm -o - | FileCheck %s
+
+void use(int);
+
+// CHECK-LABEL: @test(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[A_ADDR:%.*]] = alloca i32, align 4
+// CHECK-NEXT:store i32 [[A:%.*]], i32* [[A_ADDR]], align 4
+// CHECK-NEXT:ret void
+//
+void test(int a)
+{
+}
Index: clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c
===
--- /dev/null
+++ 

[PATCH] D97068: Run non-filechecked commands in update_cc_test_checks.py

2021-03-08 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis added a comment.

@jroelofs, thank you very much for the much useful information. I will try to 
replicate the problem with the apple triple and fix it, if possible, or 
otherwise use your patch to avoid the issue.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97068

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


[PATCH] D97068: Run non-filechecked commands in update_cc_test_checks.py

2021-03-08 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis added a comment.

In D97068#2611269 , @thakis wrote:

> Looks like this breaks tests on mac: http://45.33.8.238/macm1/5075/step_6.txt
>
> Please take a look, and revert for now if it takes a while to fix.

Hey @thakis, it should be an easy fix. I see no check lines are generated and I 
suspect something may be going wrong with the `cp` runline, but it's hard to 
know without replicating it. Is there any way you can give me temporary access 
to the mac machine to test things out?

Otherwise, I will simplify the test to exclude the `cp` runline.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97068

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


[PATCH] D97107: Replace func name with regex in update_cc_test_checks

2021-03-08 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 329008.
ggeorgakoudis added a comment.

Change regex to avoid failing windows test


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97107

Files:
  clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c
  clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected
  clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
  llvm/utils/UpdateTestChecks/common.py

Index: llvm/utils/UpdateTestChecks/common.py
===
--- llvm/utils/UpdateTestChecks/common.py
+++ llvm/utils/UpdateTestChecks/common.py
@@ -30,6 +30,8 @@
help='Activate CHECK line generation from this point forward')
   parser.add_argument('--disable', action='store_false', dest='enabled',
   help='Deactivate CHECK line generation from this point forward')
+  parser.add_argument('--replace-function-regex', nargs='+', default=[],
+  help='List of regular expressions to replace matching function names')
   args = parser.parse_args()
   global _verbose
   _verbose = args.verbose
@@ -264,6 +266,8 @@
 self._record_args = flags.function_signature
 self._check_attributes = flags.check_attributes
 self._scrubber_args = scrubber_args
+# Strip double-quotes if input was read by UTC_ARGS
+self._replace_function_regex = list(map(lambda x: x.strip('"'), flags.replace_function_regex))
 self._func_dict = {}
 self._func_order = {}
 for tuple in run_list:
@@ -331,6 +335,30 @@
   self._func_dict[prefix][func] = None
   continue
 
+# Replace function names matching the regex.
+for regex in self._replace_function_regex:
+  # Pattern that matches capture groups in the regex in leftmost order.
+  group_regex = re.compile('\(.*?\)')
+  # Replace function name with regex.
+  match = re.match(regex, func)
+  if match:
+func_repl = regex
+# Replace any capture groups with their matched strings.
+for g in match.groups():
+  func_repl = group_regex.sub(g, func_repl, count=1)
+func = '{{' + func_repl + '}}'
+
+  # Replace all calls to regex matching functions.
+  matches = re.finditer(regex, scrubbed_body)
+  for match in matches:
+func_repl = regex
+# Replace any capture groups with their matched strings.
+for g in match.groups():
+func_repl = group_regex.sub(g, func_repl, count=1)
+# Substitute function call names that match the regex with the same
+# capture groups set.
+scrubbed_body = re.sub(func_repl, '{{' + func_repl + '}}', scrubbed_body)
+
 self._func_dict[prefix][func] = function_body(
 scrubbed_body, scrubbed_extra, args_and_sig, attrs)
 self._func_order[prefix].append(func)
@@ -633,6 +661,8 @@
   continue  # Don't add default values
 autogenerated_note_args += action.option_strings[0] + ' '
 if action.const is None:  # action takes a parameter
+  if action.nargs == '+':
+value = ' '.join(map(lambda v: '"' + v.strip('"') + '"', value))
   autogenerated_note_args += '%s ' % value
   if autogenerated_note_args:
 autogenerated_note_args = ' %s %s' % (UTC_ARGS_KEY, autogenerated_note_args[:-1])
Index: clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
===
--- /dev/null
+++ clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
@@ -0,0 +1,9 @@
+## Test that CHECK lines are generated for clang-generated functions replaced
+## by regex
+
+## RUN: cp %S/Inputs/generated-funcs-regex.c %t-generated-funcs-regex.c && %update_cc_test_checks --include-generated-funcs --replace-function-regex "__([a-z]+)_offloading_[a-z0-9]+_[a-z0-9]+_(.*)_l[0-9]+" -- %t-generated-funcs-regex.c
+# RUN: diff -u %S/Inputs/generated-funcs-regex.c.expected %t-generated-funcs-regex.c
+
+## Check that re-running update_cc_test_checks doesn't change the output
+# RUN: %update_cc_test_checks %t-generated-funcs-regex.c
+# RUN: diff -u %S/Inputs/generated-funcs-regex.c.expected %t-generated-funcs-regex.c
Index: clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected
===
--- /dev/null
+++ clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected
@@ -0,0 +1,36 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --include-generated-funcs --replace-function-regex "__([a-z]+)_offloading_[a-z0-9]+_[a-z0-9]+_(.*)_l[0-9]+"
+// RUN: %clang_cc1 -fopenmp %s -emit-llvm -o - | FileCheck %s
+
+void __test_offloading_42_abcdef_bar_l123();
+void use(int);
+

[PATCH] D97068: Run non-filechecked commands in update_cc_test_checks.py

2021-03-08 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG60d4c73b30a0: Run non-filechecked commands in 
update_cc_test_checks.py (authored by ggeorgakoudis).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97068

Files:
  clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c
  clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected
  clang/test/utils/update_cc_test_checks/exec-all-runlines.test
  llvm/utils/update_cc_test_checks.py

Index: llvm/utils/update_cc_test_checks.py
===
--- llvm/utils/update_cc_test_checks.py
+++ llvm/utils/update_cc_test_checks.py
@@ -203,6 +203,14 @@
   'are discouraged in Clang testsuite.', file=sys.stderr)
 sys.exit(1)
 
+def exec_run_line(exe):
+  popen = subprocess.Popen(exe, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
+  stdout, stderr = popen.communicate()
+  if popen.returncode != 0:
+sys.stderr.write('Failed to run ' + ' '.join(exe) + '\n')
+sys.stderr.write(stderr)
+sys.stderr.write(stdout)
+sys.exit(3)
 
 def main():
   initial_args, parser = config()
@@ -221,25 +229,31 @@
   if m:
 triple_in_cmd = m.groups()[0]
 
-  # Apply %clang substitution rule, replace %s by `filename`, and append args.clang_args
-  clang_args = shlex.split(commands[0])
-  if clang_args[0] not in SUBST:
-print('WARNING: Skipping non-clang RUN line: ' + l, file=sys.stderr)
+  # Parse executable args.
+  exec_args = shlex.split(commands[0])
+  # Execute non-clang runline.
+  if exec_args[0] not in SUBST:
+print('NOTE: Executing non-clang RUN line: ' + l, file=sys.stderr)
+# Replace %s by `filename`.
+exec_args = [i.replace('%s', ti.path) if '%s' in i else i for i in exec_args]
+exec_run_line(exec_args)
 continue
+  # This is a clang runline, apply %clang substitution rule, replace %s by `filename`,
+  # and append args.clang_args
+  clang_args = exec_args
   clang_args[0:1] = SUBST[clang_args[0]]
-  clang_args = [ti.path if i == '%s' else i for i in clang_args] + ti.args.clang_args
-
-  # Permit piping the output through opt
-  if not (len(commands) == 2 or
-  (len(commands) == 3 and commands[1].startswith('opt'))):
-print('WARNING: Skipping non-clang RUN line: ' + l, file=sys.stderr)
+  clang_args = [i.replace('%s', ti.path) if '%s' in i else i for i in clang_args] + ti.args.clang_args
 
   # Extract -check-prefix in FileCheck args
   filecheck_cmd = commands[-1]
   common.verify_filecheck_prefixes(filecheck_cmd)
   if not filecheck_cmd.startswith('FileCheck '):
-print('WARNING: Skipping non-FileChecked RUN line: ' + l, file=sys.stderr)
+print('NOTE: Executing non-FileChecked clang RUN line: ' + l, file=sys.stderr)
+# Execute non-filechecked clang runline.
+exe = [ti.args.clang] + clang_args
+exec_run_line(exe)
 continue
+
   check_prefixes = [item for m in common.CHECK_PREFIX_RE.finditer(filecheck_cmd)
for item in m.group(1).split(',')]
   if not check_prefixes:
Index: clang/test/utils/update_cc_test_checks/exec-all-runlines.test
===
--- /dev/null
+++ clang/test/utils/update_cc_test_checks/exec-all-runlines.test
@@ -0,0 +1,8 @@
+## Test that non-clang/non-filechecked runlines execute
+
+# RUN: cp %S/Inputs/exec-all-runlines.c %t-generated.c && %update_cc_test_checks %t-generated.c
+# RUN: diff -u %S/Inputs/exec-all-runlines.c.expected %t-generated.c
+
+## Check that re-running update_cc_test_checks doesn't change the output
+# RUN: %update_cc_test_checks %t-generated.c
+# RUN: diff -u %S/Inputs/exec-all-runlines.c.expected %t-generated.c
Index: clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected
===
--- /dev/null
+++ clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected
@@ -0,0 +1,17 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
+// Check that the non-clang/non-filechecked runlines execute
+// RUN: cp %s %s.copy.c
+// RUN: %clang_cc1 -fopenmp %s.copy.c -emit-llvm-bc -o %t-host.bc
+// RUN: %clang_cc1 -fopenmp -fopenmp-host-ir-file-path %t-host.bc %s.copy.c -emit-llvm -o - | FileCheck %s
+
+void use(int);
+
+// CHECK-LABEL: @test(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[A_ADDR:%.*]] = alloca i32, align 4
+// CHECK-NEXT:store i32 [[A:%.*]], i32* [[A_ADDR]], align 4
+// CHECK-NEXT:ret void
+//
+void test(int a)
+{
+}
Index: clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c

[PATCH] D97068: Run non-filechecked commands in update_cc_test_checks.py

2021-03-07 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 328887.
ggeorgakoudis added a comment.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Update implementation to support running non-clang runlines, add tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97068

Files:
  clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c
  clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected
  clang/test/utils/update_cc_test_checks/exec-all-runlines.test
  llvm/utils/update_cc_test_checks.py

Index: llvm/utils/update_cc_test_checks.py
===
--- llvm/utils/update_cc_test_checks.py
+++ llvm/utils/update_cc_test_checks.py
@@ -203,6 +203,14 @@
   'are discouraged in Clang testsuite.', file=sys.stderr)
 sys.exit(1)
 
+def exec_run_line(exe):
+  popen = subprocess.Popen(exe, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
+  stdout, stderr = popen.communicate()
+  if popen.returncode != 0:
+sys.stderr.write('Failed to run ' + ' '.join(exe) + '\n')
+sys.stderr.write(stderr)
+sys.stderr.write(stdout)
+sys.exit(3)
 
 def main():
   initial_args, parser = config()
@@ -221,25 +229,31 @@
   if m:
 triple_in_cmd = m.groups()[0]
 
-  # Apply %clang substitution rule, replace %s by `filename`, and append args.clang_args
-  clang_args = shlex.split(commands[0])
-  if clang_args[0] not in SUBST:
-print('WARNING: Skipping non-clang RUN line: ' + l, file=sys.stderr)
+  # Parse executable args.
+  exec_args = shlex.split(commands[0])
+  # Execute non-clang runline.
+  if exec_args[0] not in SUBST:
+print('NOTE: Executing non-clang RUN line: ' + l, file=sys.stderr)
+# Replace %s by `filename`.
+exec_args = [i.replace('%s', ti.path) if '%s' in i else i for i in exec_args]
+exec_run_line(exec_args)
 continue
+  # This is a clang runline, apply %clang substitution rule, replace %s by `filename`,
+  # and append args.clang_args
+  clang_args = exec_args
   clang_args[0:1] = SUBST[clang_args[0]]
-  clang_args = [ti.path if i == '%s' else i for i in clang_args] + ti.args.clang_args
-
-  # Permit piping the output through opt
-  if not (len(commands) == 2 or
-  (len(commands) == 3 and commands[1].startswith('opt'))):
-print('WARNING: Skipping non-clang RUN line: ' + l, file=sys.stderr)
+  clang_args = [i.replace('%s', ti.path) if '%s' in i else i for i in clang_args] + ti.args.clang_args
 
   # Extract -check-prefix in FileCheck args
   filecheck_cmd = commands[-1]
   common.verify_filecheck_prefixes(filecheck_cmd)
   if not filecheck_cmd.startswith('FileCheck '):
-print('WARNING: Skipping non-FileChecked RUN line: ' + l, file=sys.stderr)
+print('NOTE: Executing non-FileChecked clang RUN line: ' + l, file=sys.stderr)
+# Execute non-filechecked clang runline.
+exe = [ti.args.clang] + clang_args
+exec_run_line(exe)
 continue
+
   check_prefixes = [item for m in common.CHECK_PREFIX_RE.finditer(filecheck_cmd)
for item in m.group(1).split(',')]
   if not check_prefixes:
Index: clang/test/utils/update_cc_test_checks/exec-all-runlines.test
===
--- /dev/null
+++ clang/test/utils/update_cc_test_checks/exec-all-runlines.test
@@ -0,0 +1,8 @@
+## Test that non-clang/non-filechecked runlines execute
+
+# RUN: cp %S/Inputs/exec-all-runlines.c %t-generated.c && %update_cc_test_checks %t-generated.c
+# RUN: diff -u %S/Inputs/exec-all-runlines.c.expected %t-generated.c
+
+## Check that re-running update_cc_test_checks doesn't change the output
+# RUN: %update_cc_test_checks %t-generated.c
+# RUN: diff -u %S/Inputs/exec-all-runlines.c.expected %t-generated.c
Index: clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected
===
--- /dev/null
+++ clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected
@@ -0,0 +1,17 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
+// Check that the non-clang/non-filechecked runlines execute
+// RUN: cp %s %s.copy.c
+// RUN: %clang_cc1 -fopenmp %s.copy.c -emit-llvm-bc -o %t-host.bc
+// RUN: %clang_cc1 -fopenmp -fopenmp-host-ir-file-path %t-host.bc %s.copy.c -emit-llvm -o - | FileCheck %s
+
+void use(int);
+
+// CHECK-LABEL: @test(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[A_ADDR:%.*]] = alloca i32, align 4
+// CHECK-NEXT:store i32 [[A:%.*]], i32* [[A_ADDR]], align 4
+// CHECK-NEXT:ret void
+//
+void test(int a)
+{
+}
Index: clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c

  1   2   >