[PATCH] D82822: [OpenMP][FIX] Consistently use OpenMPIRBuilder if requested

2020-08-02 Thread Hongtao Yu via Phabricator via cfe-commits
hoyFB added a comment.

In D82822#2189692 , @jdoerfert wrote:

> In D82822#2189366 , @hoyFB wrote:
>
>> In D82822#2187576 , @jdoerfert 
>> wrote:
>>
>>> @davezarzycki The bots reported this as well, didn't build MLIR locally, 
>>> this should have been fixed by 4d83aa4771d84940626d86c883193af390812281 
>>> 
>>
>> I was seeing the same issue with what @davezarzycki has encountered. Not 
>> sure why this is related to MLIR. The failure is cause by this line:
>>
>>   74: // CHECK-DEBUG-NEXT:[[OMP_GLOBAL_THREAD_NUM:%.*]] = call i32 
>> @__kmpc_global_thread_num(%struct.ident_t* **@12**), !dbg !{{[0-9]*}}
>>
>> where `@12` is supposed to be defined as
>>
>>   @11 = private unnamed_addr constant [90 x i8] 
>> c";llvm-project/clang/test/OpenMP/irbuilder_nested_parallel_for.c;parallel_for_1;85;1;;\00",
>>  align 1
>>   @12 = private unnamed_addr global %struct.ident_t { i32 0, i32 2, i32 0, 
>> i32 0, i8* getelementptr inbounds ([90 x i8], [90 x i8]* @11, i32 0, i32 0) 
>> }, align 8
>>
>> The exact match of `@12` seems a bit fragile to me since global data names 
>> could be changed from time to time. Can you please make it bit more robust? 
>> Thank
>
> I just created D85099  to eliminate the 
> problem permanently. Feel free to take a look.

Thanks for the quick turnaround!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82822

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


[PATCH] D82822: [OpenMP][FIX] Consistently use OpenMPIRBuilder if requested

2020-08-02 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added a comment.

In D82822#2189366 , @hoyFB wrote:

> In D82822#2187576 , @jdoerfert wrote:
>
>> @davezarzycki The bots reported this as well, didn't build MLIR locally, 
>> this should have been fixed by 4d83aa4771d84940626d86c883193af390812281 
>> 
>
> I was seeing the same issue with what @davezarzycki has encountered. Not sure 
> why this is related to MLIR. The failure is cause by this line:
>
>   74: // CHECK-DEBUG-NEXT:[[OMP_GLOBAL_THREAD_NUM:%.*]] = call i32 
> @__kmpc_global_thread_num(%struct.ident_t* **@12**), !dbg !{{[0-9]*}}
>
> where `@12` is supposed to be defined as
>
>   @11 = private unnamed_addr constant [90 x i8] 
> c";llvm-project/clang/test/OpenMP/irbuilder_nested_parallel_for.c;parallel_for_1;85;1;;\00",
>  align 1
>   @12 = private unnamed_addr global %struct.ident_t { i32 0, i32 2, i32 0, 
> i32 0, i8* getelementptr inbounds ([90 x i8], [90 x i8]* @11, i32 0, i32 0) 
> }, align 8
>
> The exact match of `@12` seems a bit fragile to me since global data names 
> could be changed from time to time. Can you please make it bit more robust? 
> Thank

I just created D85099  to eliminate the 
problem permanently. Feel free to take a look.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82822

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


[PATCH] D82822: [OpenMP][FIX] Consistently use OpenMPIRBuilder if requested

2020-08-02 Thread Hongtao Yu via Phabricator via cfe-commits
hoyFB added a comment.

In D82822#2187576 , @jdoerfert wrote:

> @davezarzycki The bots reported this as well, didn't build MLIR locally, this 
> should have been fixed by 4d83aa4771d84940626d86c883193af390812281 
> 

I was seeing the same issue with what @davezarzycki has encountered. Not sure 
why this is related to MLIR. The failure is cause by this line:

  74: // CHECK-DEBUG-NEXT:[[OMP_GLOBAL_THREAD_NUM:%.*]] = call i32 
@__kmpc_global_thread_num(%struct.ident_t* **@12**), !dbg !{{[0-9]*}}

where `@12` is supposed to be defined as

  @11 = private unnamed_addr constant [90 x i8] 
c";llvm-project/clang/test/OpenMP/irbuilder_nested_parallel_for.c;parallel_for_1;85;1;;\00",
 align 1
  @12 = private unnamed_addr global %struct.ident_t { i32 0, i32 2, i32 0, i32 
0, i8* getelementptr inbounds ([90 x i8], [90 x i8]* @11, i32 0, i32 0) }, 
align 8

The exact match of `@12` seems a bit fragile to me since global data names 
could be changed from time to time. Can you please make it bit more robust? 
Thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82822

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


[PATCH] D82822: [OpenMP][FIX] Consistently use OpenMPIRBuilder if requested

2020-07-31 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added a comment.

@davezarzycki The bots reported this as well, didn't build MLIR locally, this 
should have been fixed by 4d83aa4771d84940626d86c883193af390812281 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82822

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


[PATCH] D82822: [OpenMP][FIX] Consistently use OpenMPIRBuilder if requested

2020-07-31 Thread David Zarzycki via Phabricator via cfe-commits
davezarzycki added a comment.

Hello, I have a twice-daily auto-bisecting multi-stage cron job running on 
Fedora 32 (x86-64) that has identified this commit as failing my first stage 
test (release + no asserts). Is this expected? Can we get a quick fix or revert 
this?

FAIL: Clang :: OpenMP/irbuilder_nested_parallel_for.c (13233 of 67864)

- TEST 'Clang :: OpenMP/irbuilder_nested_parallel_for.c' FAILED 


Script:
---

: 'RUN: at line 2';   /tmp/_update_lc/r/bin/clang -cc1 -internal-isystem 
/tmp/_update_lc/r/lib/clang/12.0.0/include -nostdsysteminc -verify -fopenmp 
-fopenmp-enable-irbuilder -x c++ -emit-llvm 
/home/dave/ro_s/lp/clang/test/OpenMP/irbuilder_nested_parallel_for.c -triple 
x86_64-unknown-unknown -fexceptions -fcxx-exceptions -o - | 
/tmp/_update_lc/r/bin/FileCheck --check-prefixes=CHECK 
/home/dave/ro_s/lp/clang/test/OpenMP/irbuilder_nested_parallel_for.c

: 'RUN: at line 3';   /tmp/_update_lc/r/bin/clang -cc1 -internal-isystem 
/tmp/_update_lc/r/lib/clang/12.0.0/include -nostdsysteminc -fopenmp 
-fopenmp-enable-irbuilder -x c++ -triple x86_64-unknown-unknown -fexceptions 
-fcxx-exceptions -debug-info-kind=limited -std=c++11 -verify 
/home/dave/ro_s/lp/clang/test/OpenMP/irbuilder_nested_parallel_for.c -emit-llvm 
-o - | /tmp/_update_lc/r/bin/FileCheck --check-prefixes=CHECK-DEBUG 
/home/dave/ro_s/lp/clang/test/OpenMP/irbuilder_nested_parallel_for.c
---

Exit Code: 1

Command Output (stderr):


/home/dave/ro_s/lp/clang/test/OpenMP/irbuilder_nested_parallel_for.c:74:22: 
error: CHECK-DEBUG-NEXT: is not on the line after the previous match
// CHECK-DEBUG-NEXT: [[OMP_GLOBAL_THREAD_NUM:%.*]] = call i32 
@__kmpc_global_thread_num(%struct.ident_t* @12), !dbg !{{[0-9]*}}

  ^

:252:2: note: 'next' match was here
 %omp_global_thread_num1 = call i32 @__kmpc_global_thread_num(%struct.ident_t* 
@12), !dbg !52
 ^
:224:105: note: previous match ended here
 call void @llvm.dbg.declare(metadata double* %b.addr, metadata !45, metadata 
!DIExpression()), !dbg !46

  ^

:225:1: note: non-matching line after previous match is here
 %omp_global_thread_num = call i32 @__kmpc_global_thread_num(%struct.ident_t* 
@10), !dbg !47
^
/home/dave/ro_s/lp/clang/test/OpenMP/irbuilder_nested_parallel_for.c:192:22: 
error: CHECK-DEBUG-NEXT: expected string not found in input
// CHECK-DEBUG-NEXT: [[OMP_GLOBAL_THREAD_NUM:%.*]] = call i32 
@__kmpc_global_thread_num(%struct.ident_t* @25), !dbg !{{[0-9]*}}

  ^

:381:2: note: scanning from here
 %omp_global_thread_num = call i32 @__kmpc_global_thread_num(%struct.ident_t* 
@21), !dbg !83
 ^
:381:19: note: possible intended match here
 %omp_global_thread_num = call i32 @__kmpc_global_thread_num(%struct.ident_t* 
@21), !dbg !83

  ^

Input file: 
Check file: /home/dave/ro_s/lp/clang/test/OpenMP/irbuilder_nested_parallel_for.c

-dump-input=help explains the following input dump.

Input was:
<<

.
.
.
  247:
  248: omp.par.outlined.exit19.exitStub: ; preds = %omp.par.pre_finalize
  249:  ret void
  250:
  251: omp.par.region: ; preds = %omp.par.entry
  252:  %omp_global_thread_num1 = call i32 
@__kmpc_global_thread_num(%struct.ident_t* @12), !dbg !52

next:74 
!~~~
 error: match on wrong line

  253:  br label %omp_parallel
  254:
  255: omp_parallel: ; preds = %omp.par.region
  256:  call void (%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) 
@__kmpc_fork_call(%struct.ident_t* @12, i32 3, void (i32*, i32*, ...)* bitcast 
(void (i32*, i32*, i32*, double*, float**)* @_Z14parallel_for_1Pfid..omp_par to 
void (i32*, i32*, ...)*), i32* %a.addr, double* %b.addr, float** %r.addr), !dbg 
!53
  257:  br label %omp.par.outlined.exit
.
.
.
  376:  call void @llvm.dbg.declare(metadata float** %r.addr, metadata !77, 
metadata !DIExpression()), !dbg !78
  377:  store i32 %a, i32* %a.addr, align 4
  378:  call void @llvm.dbg.declare(metadata i32* %a.addr, metadata !79, 
metadata !DIExpression()), !dbg !80
  379:  store double %b, double* %b.addr, align 8
  380:  call void @llvm.dbg.declare(metadata double* %b.addr, metadata !81, 
metadata !DIExpression()), !dbg !82
  381:  %omp_global_thread_num = call i32 
@__kmpc_global_thread_num(%struct.ident_t* @21), !dbg !83

next:192'0  
X~~
 error: no match found
next:192'1 

[PATCH] D82822: [OpenMP][FIX] Consistently use OpenMPIRBuilder if requested

2020-07-30 Thread Johannes Doerfert 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 rGebad64dfe133: [OpenMP][FIX] Consistently use OpenMPIRBuilder 
if requested (authored by jdoerfert).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82822

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/test/OpenMP/cancel_codegen.cpp
  clang/test/OpenMP/irbuilder_nested_parallel_for.c
  clang/test/OpenMP/task_codegen.cpp

Index: clang/test/OpenMP/task_codegen.cpp
===
--- clang/test/OpenMP/task_codegen.cpp
+++ clang/test/OpenMP/task_codegen.cpp
@@ -33,12 +33,11 @@
   char b;
   S s[2];
   int arr[10][a];
-// CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num([[IDENT_T]]* @{{.+}})
 // CHECK: [[B_REF:%.+]] = getelementptr inbounds [[STRUCT_SHAREDS]], [[STRUCT_SHAREDS]]* [[CAPTURES:%.+]], i32 0, i32 0
 // CHECK: store i8* [[B]], i8** [[B_REF]]
 // CHECK: [[S_REF:%.+]] = getelementptr inbounds [[STRUCT_SHAREDS]], [[STRUCT_SHAREDS]]* [[CAPTURES]], i32 0, i32 1
 // CHECK: store [2 x [[STRUCT_S]]]* [[S]], [2 x [[STRUCT_S]]]** [[S_REF]]
-// CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i32 33, i64 40, i64 16, i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_T]]{{.*}}*)* [[TASK_ENTRY1:@.+]] to i32 (i32, i8*)*))
+// CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc([[IDENT_T]]* @{{.+}}, i32 {{%.*}}, i32 33, i64 40, i64 16, i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_T]]{{.*}}*)* [[TASK_ENTRY1:@.+]] to i32 (i32, i8*)*))
 // CHECK: [[SHAREDS_REF_PTR:%.+]] = getelementptr inbounds [[KMP_TASK_T]], [[KMP_TASK_T]]* [[TASK_PTR:%.+]], i32 0, i32 0
 // CHECK: [[SHAREDS_REF:%.+]] = load i8*, i8** [[SHAREDS_REF_PTR]]
 // CHECK: [[BITCAST:%.+]] = bitcast [[STRUCT_SHAREDS]]* [[CAPTURES]] to i8*
@@ -46,7 +45,7 @@
 // CHECK: [[PRIORITY_REF_PTR:%.+]] = getelementptr inbounds [[KMP_TASK_T]], [[KMP_TASK_T]]* [[TASK_PTR]], i32 0, i32 4
 // CHECK: [[PRIORITY:%.+]] = bitcast %union{{.+}}* [[PRIORITY_REF_PTR]] to i32*
 // CHECK: store i32 {{.+}}, i32* [[PRIORITY]]
-// CHECK: call i32 @__kmpc_omp_task([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i8* [[ORIG_TASK_PTR]])
+// CHECK: call i32 @__kmpc_omp_task([[IDENT_T]]* @{{.+}}, i32 {{%.*}}, i8* [[ORIG_TASK_PTR]])
 #pragma omp task shared(a, b, s) priority(b)
   {
 a = 15;
@@ -55,7 +54,7 @@
   }
 // CHECK: [[S_REF:%.+]] = getelementptr inbounds [[STRUCT_SHAREDS1]], [[STRUCT_SHAREDS1]]* [[CAPTURES:%.+]], i32 0, i32 0
 // CHECK: store [2 x [[STRUCT_S]]]* [[S]], [2 x [[STRUCT_S]]]** [[S_REF]]
-// CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc([[IDENT_T]]* @{{[^,]+}}, i32 [[GTID]], i32 1, i64 40, i64 8,
+// CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc([[IDENT_T]]* @{{[^,]+}}, i32 {{%.*}}, i32 1, i64 40, i64 8,
 // CHECK: [[SHAREDS_REF_PTR:%.+]] = getelementptr inbounds [[KMP_TASK_T]], [[KMP_TASK_T]]* [[TASK_PTR:%.+]], i32 0, i32 0
 // CHECK: [[SHAREDS_REF:%.+]] = load i8*, i8** [[SHAREDS_REF_PTR]]
 // CHECK: [[BITCAST:%.+]] = bitcast [[STRUCT_SHAREDS1]]* [[CAPTURES]] to i8*
@@ -101,20 +100,20 @@
 // CHECK: [[T0:%.*]] = getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 2
 // CHECK: store i8 1, i8* [[T0]]
 // CHECK: bitcast [[KMP_DEPEND_INFO]]* [[DEP_BASE]] to i8*
-// CHECK: call i32 @__kmpc_omp_task_with_deps([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i8* [[ORIG_TASK_PTR]], i32 4, i8* %{{[^,]+}}, i32 0, i8* null)
+// CHECK: call i32 @__kmpc_omp_task_with_deps([[IDENT_T]]* @{{.+}}, i32 {{%.*}}, i8* [[ORIG_TASK_PTR]], i32 4, i8* %{{[^,]+}}, i32 0, i8* null)
 #pragma omp task shared(a, s) depend(in : a, b, s, arr[:])
   {
 a = 15;
 s[1].a = 10;
   }
-// CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i32 0, i64 40, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_T]]{{.*}}*)* [[TASK_ENTRY2:@.+]] to i32 (i32, i8*)*))
-// CHECK: call i32 @__kmpc_omp_task([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i8* [[ORIG_TASK_PTR]])
+// CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc([[IDENT_T]]* @{{.+}}, i32 {{%.*}}, i32 0, i64 40, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_T]]{{.*}}*)* [[TASK_ENTRY2:@.+]] to i32 (i32, i8*)*))
+// CHECK: call i32 @__kmpc_omp_task([[IDENT_T]]* @{{.+}}, i32 {{%.*}}, i8* [[ORIG_TASK_PTR]])
 #pragma omp task untied
   {
 #pragma omp critical
 a = 1;
   }
-// CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i32 0, i64 40, i64 1,
+// CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc([[IDENT_T]]* @{{.+}}, i32 {{%.*}}, i32 0, i64 40, i64 1,
 // CHECK: getelementptr inbounds [2 x [[STRUCT_S]]], [2 x [[STRUCT_S]]]* [[S]], i64 0, i64 0
 // CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}

[PATCH] D82822: [OpenMP][FIX] Consistently use OpenMPIRBuilder if requested

2020-07-13 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert updated this revision to Diff 277635.
jdoerfert added a comment.

Rebase


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82822

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/test/OpenMP/cancel_codegen.cpp
  clang/test/OpenMP/irbuilder_nested_parallel_for.c
  clang/test/OpenMP/task_codegen.cpp

Index: clang/test/OpenMP/task_codegen.cpp
===
--- clang/test/OpenMP/task_codegen.cpp
+++ clang/test/OpenMP/task_codegen.cpp
@@ -33,12 +33,11 @@
   char b;
   S s[2];
   int arr[10][a];
-// CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num([[IDENT_T]]* @{{.+}})
 // CHECK: [[B_REF:%.+]] = getelementptr inbounds [[STRUCT_SHAREDS]], [[STRUCT_SHAREDS]]* [[CAPTURES:%.+]], i32 0, i32 0
 // CHECK: store i8* [[B]], i8** [[B_REF]]
 // CHECK: [[S_REF:%.+]] = getelementptr inbounds [[STRUCT_SHAREDS]], [[STRUCT_SHAREDS]]* [[CAPTURES]], i32 0, i32 1
 // CHECK: store [2 x [[STRUCT_S]]]* [[S]], [2 x [[STRUCT_S]]]** [[S_REF]]
-// CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i32 33, i64 40, i64 16, i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_T]]{{.*}}*)* [[TASK_ENTRY1:@.+]] to i32 (i32, i8*)*))
+// CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc([[IDENT_T]]* @{{.+}}, i32 {{%.*}}, i32 33, i64 40, i64 16, i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_T]]{{.*}}*)* [[TASK_ENTRY1:@.+]] to i32 (i32, i8*)*))
 // CHECK: [[SHAREDS_REF_PTR:%.+]] = getelementptr inbounds [[KMP_TASK_T]], [[KMP_TASK_T]]* [[TASK_PTR:%.+]], i32 0, i32 0
 // CHECK: [[SHAREDS_REF:%.+]] = load i8*, i8** [[SHAREDS_REF_PTR]]
 // CHECK: [[BITCAST:%.+]] = bitcast [[STRUCT_SHAREDS]]* [[CAPTURES]] to i8*
@@ -46,7 +45,7 @@
 // CHECK: [[PRIORITY_REF_PTR:%.+]] = getelementptr inbounds [[KMP_TASK_T]], [[KMP_TASK_T]]* [[TASK_PTR]], i32 0, i32 4
 // CHECK: [[PRIORITY:%.+]] = bitcast %union{{.+}}* [[PRIORITY_REF_PTR]] to i32*
 // CHECK: store i32 {{.+}}, i32* [[PRIORITY]]
-// CHECK: call i32 @__kmpc_omp_task([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i8* [[ORIG_TASK_PTR]])
+// CHECK: call i32 @__kmpc_omp_task([[IDENT_T]]* @{{.+}}, i32 {{%.*}}, i8* [[ORIG_TASK_PTR]])
 #pragma omp task shared(a, b, s) priority(b)
   {
 a = 15;
@@ -55,7 +54,7 @@
   }
 // CHECK: [[S_REF:%.+]] = getelementptr inbounds [[STRUCT_SHAREDS1]], [[STRUCT_SHAREDS1]]* [[CAPTURES:%.+]], i32 0, i32 0
 // CHECK: store [2 x [[STRUCT_S]]]* [[S]], [2 x [[STRUCT_S]]]** [[S_REF]]
-// CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc([[IDENT_T]]* @{{[^,]+}}, i32 [[GTID]], i32 1, i64 40, i64 8,
+// CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc([[IDENT_T]]* @{{[^,]+}}, i32 {{%.*}}, i32 1, i64 40, i64 8,
 // CHECK: [[SHAREDS_REF_PTR:%.+]] = getelementptr inbounds [[KMP_TASK_T]], [[KMP_TASK_T]]* [[TASK_PTR:%.+]], i32 0, i32 0
 // CHECK: [[SHAREDS_REF:%.+]] = load i8*, i8** [[SHAREDS_REF_PTR]]
 // CHECK: [[BITCAST:%.+]] = bitcast [[STRUCT_SHAREDS1]]* [[CAPTURES]] to i8*
@@ -101,20 +100,20 @@
 // CHECK: [[T0:%.*]] = getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 2
 // CHECK: store i8 1, i8* [[T0]]
 // CHECK: bitcast [[KMP_DEPEND_INFO]]* [[DEP_BASE]] to i8*
-// CHECK: call i32 @__kmpc_omp_task_with_deps([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i8* [[ORIG_TASK_PTR]], i32 4, i8* %{{[^,]+}}, i32 0, i8* null)
+// CHECK: call i32 @__kmpc_omp_task_with_deps([[IDENT_T]]* @{{.+}}, i32 {{%.*}}, i8* [[ORIG_TASK_PTR]], i32 4, i8* %{{[^,]+}}, i32 0, i8* null)
 #pragma omp task shared(a, s) depend(in : a, b, s, arr[:])
   {
 a = 15;
 s[1].a = 10;
   }
-// CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i32 0, i64 40, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_T]]{{.*}}*)* [[TASK_ENTRY2:@.+]] to i32 (i32, i8*)*))
-// CHECK: call i32 @__kmpc_omp_task([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i8* [[ORIG_TASK_PTR]])
+// CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc([[IDENT_T]]* @{{.+}}, i32 {{%.*}}, i32 0, i64 40, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_T]]{{.*}}*)* [[TASK_ENTRY2:@.+]] to i32 (i32, i8*)*))
+// CHECK: call i32 @__kmpc_omp_task([[IDENT_T]]* @{{.+}}, i32 {{%.*}}, i8* [[ORIG_TASK_PTR]])
 #pragma omp task untied
   {
 #pragma omp critical
 a = 1;
   }
-// CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i32 0, i64 40, i64 1,
+// CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc([[IDENT_T]]* @{{.+}}, i32 {{%.*}}, i32 0, i64 40, i64 1,
 // CHECK: getelementptr inbounds [2 x [[STRUCT_S]]], [2 x [[STRUCT_S]]]* [[S]], i64 0, i64 0
 // CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 0
 // CHECK: ptrtoint [[STRUCT_S]]* %{{.+}} to i64
@@ -146,12 +145,12 @@
 // CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{

[PATCH] D82822: [OpenMP][FIX] Consistently use OpenMPIRBuilder if requested

2020-07-02 Thread Fady Ghanim via Phabricator via cfe-commits
fghanim added a comment.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82822



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


[PATCH] D82822: [OpenMP][FIX] Consistently use OpenMPIRBuilder if requested

2020-06-30 Thread Anchu Rajendran S via Phabricator via cfe-commits
anchu-rajendran accepted this revision.
anchu-rajendran added a comment.
This revision is now accepted and ready to land.

LGTM :). Thanks!




Comment at: clang/lib/CodeGen/CGOpenMPRuntime.cpp:1543
+OMPBuilder->getOrCreateIdent(SrcLocStr));
+  }
 

Nit: I think its better to add comments on the implicit assumptions in clang 
code / on why initializations here is not required if OMPIRBuilder is not used. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82822



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


[PATCH] D82822: [OpenMP][FIX] Consistently use OpenMPIRBuilder if requested

2020-06-29 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert created this revision.
jdoerfert added reviewers: anchu-rajendran, kiranktp, fghanim.
Herald added subscribers: sstefan1, guansong, bollu, yaxunl.
Herald added a project: clang.

When we use the OpenMPIRBuilder for the parallel region we need to also
use it to get the thread ID (among other things) in the body. This is
because CGOpenMPRuntime::getThreadID() and
CGOpenMPRuntime::emitUpdateLocation implicitly assumes that if they are
called from within a parallel region there is a certain structure to the
code and certain members of the OMPRegionInfo are initialized. It might
make sense to initialize them even if we use the OpenMPIRBuilder but we
would preferably get rid of such state instead.

Bug reported by Anchu Rajendran Sudhakumari.

Depends on D82470 .


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82822

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/test/OpenMP/irbuilder_nested_parallel_for.c

Index: clang/test/OpenMP/irbuilder_nested_parallel_for.c
===
--- /dev/null
+++ clang/test/OpenMP/irbuilder_nested_parallel_for.c
@@ -0,0 +1,299 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
+// RUN: %clang_cc1 -verify -fopenmp -fopenmp-enable-irbuilder -x c++ -emit-llvm %s -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -o - | FileCheck --check-prefixes=CHECK %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-enable-irbuilder -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -debug-info-kind=limited -std=c++11 -verify %s -emit-llvm -o - | FileCheck --check-prefixes=CHECK-DEBUG %s
+
+// expected-no-diagnostics
+
+// TODO: Teach the update script to check new functions too.
+
+#ifndef HEADER
+#define HEADER
+
+// CHECK-LABEL: @_Z14parallel_for_0v(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[OMP_GLOBAL_THREAD_NUM:%.*]] = call i32 @__kmpc_global_thread_num(%struct.ident_t* @1)
+// CHECK-NEXT:br label [[OMP_PARALLEL:%.*]]
+// CHECK:   omp_parallel:
+// CHECK-NEXT:call void (%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(%struct.ident_t* @1, i32 0, void (i32*, i32*, ...)* bitcast (void (i32*, i32*)* @_Z14parallel_for_0v..omp_par to void (i32*, i32*, ...)*))
+// CHECK-NEXT:br label [[OMP_PAR_OUTLINED_EXIT:%.*]]
+// CHECK:   omp.par.outlined.exit:
+// CHECK-NEXT:br label [[OMP_PAR_EXIT_SPLIT:%.*]]
+// CHECK:   omp.par.exit.split:
+// CHECK-NEXT:ret void
+//
+// CHECK-DEBUG-LABEL: @_Z14parallel_for_0v(
+// CHECK-DEBUG-NEXT:  entry:
+// CHECK-DEBUG-NEXT:[[OMP_GLOBAL_THREAD_NUM:%.*]] = call i32 @__kmpc_global_thread_num(%struct.ident_t* @1), !dbg !10
+// CHECK-DEBUG-NEXT:br label [[OMP_PARALLEL:%.*]]
+// CHECK-DEBUG:   omp_parallel:
+// CHECK-DEBUG-NEXT:call void (%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(%struct.ident_t* @1, i32 0, void (i32*, i32*, ...)* bitcast (void (i32*, i32*)* @_Z14parallel_for_0v..omp_par to void (i32*, i32*, ...)*)), !dbg !11
+// CHECK-DEBUG-NEXT:br label [[OMP_PAR_OUTLINED_EXIT:%.*]]
+// CHECK-DEBUG:   omp.par.outlined.exit:
+// CHECK-DEBUG-NEXT:br label [[OMP_PAR_EXIT_SPLIT:%.*]]
+// CHECK-DEBUG:   omp.par.exit.split:
+// CHECK-DEBUG-NEXT:ret void, !dbg !14
+//
+void parallel_for_0(void) {
+#pragma omp parallel
+  {
+#pragma omp for
+for (int i = 0; i < 100; ++i) {
+}
+  }
+}
+
+// CHECK-LABEL: @_Z14parallel_for_1Pfid(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[R_ADDR:%.*]] = alloca float*, align 8
+// CHECK-NEXT:[[A_ADDR:%.*]] = alloca i32, align 4
+// CHECK-NEXT:[[B_ADDR:%.*]] = alloca double, align 8
+// CHECK-NEXT:store float* [[R:%.*]], float** [[R_ADDR]], align 8
+// CHECK-NEXT:store i32 [[A:%.*]], i32* [[A_ADDR]], align 4
+// CHECK-NEXT:store double [[B:%.*]], double* [[B_ADDR]], align 8
+// CHECK-NEXT:[[OMP_GLOBAL_THREAD_NUM:%.*]] = call i32 @__kmpc_global_thread_num(%struct.ident_t* @1)
+// CHECK-NEXT:br label [[OMP_PARALLEL:%.*]]
+// CHECK:   omp_parallel:
+// CHECK-NEXT:call void (%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(%struct.ident_t* @1, i32 3, void (i32*, i32*, ...)* bitcast (void (i32*, i32*, i32*, double*, float**)* @_Z14parallel_for_1Pfid..omp_par.1 to void (i32*, i32*, ...)*), i32* [[A_ADDR]], double* [[B_ADDR]], float** [[R_ADDR]])
+// CHECK-NEXT:br label [[OMP_PAR_OUTLINED_EXIT19:%.*]]
+// CHECK:   omp.par.outlined.exit19:
+// CHECK-NEXT:br label [[OMP_PAR_EXIT_SPLIT:%.*]]
+// CHECK:   omp.par.exit.split:
+// CHECK-NEXT:ret void
+//
+// CHECK-DEBUG-LABEL: @_Z14parallel_for_1Pfid(
+// CHECK-DEBUG-NEXT:  entry:
+// CHECK-DEBUG-NEXT:[[R_ADDR:%.*]] = alloca float*, align 8
+// CHECK-DEBUG-NEXT:[[A_ADDR:%.*]] = alloca i32, align 4
+// CHECK-DEBUG-NEXT:[[B_ADDR:%.*]] = alloca double, align 8
+// CHECK-DEBUG-NEXT:store float* [[R:%.*]], float** [[R_ADDR]], alig