[PATCH] D85938: [OpenMP][NFC] Update check lines after D85099

2020-08-13 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert updated this revision to Diff 285551.
jdoerfert added a comment.
This revision is now accepted and ready to land.
Herald added subscribers: llvm-commits, ormris, hiraditya.
Herald added a project: LLVM.

Resolve the root cause


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85938

Files:
  clang/test/OpenMP/irbuilder_nested_parallel_for.c
  llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
  llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp

Index: llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
===
--- llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
+++ llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
@@ -34,7 +34,8 @@
 BB = BasicBlock::Create(Ctx, "", F);
 
 DIBuilder DIB(*M);
-auto File = DIB.createFile("test.dbg", "/");
+auto File = DIB.createFile("test.dbg", "/src", llvm::None,
+   Optional("/src/test.dbg"));
 auto CU =
 DIB.createCompileUnit(dwarf::DW_LANG_C, File, "llvm-C", true, "", 0);
 auto Type = DIB.createSubroutineType(DIB.getOrCreateTypeArray(None));
@@ -301,7 +302,7 @@
   dyn_cast(SrcStrGlob->getInitializer());
   if (!SrcSrc)
 return;
-  EXPECT_EQ(SrcSrc->getAsCString(), ";test.dbg;foo;3;7;;");
+  EXPECT_EQ(SrcSrc->getAsCString(), ";/src/test.dbg;foo;3;7;;");
 }
 
 TEST_F(OpenMPIRBuilderTest, ParallelSimple) {
Index: llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
===
--- llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+++ llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
@@ -263,8 +263,10 @@
   DILocation *DIL = Loc.DL.get();
   if (!DIL)
 return getOrCreateDefaultSrcLocStr();
-  StringRef FileName =
-  !DIL->getFilename().empty() ? DIL->getFilename() : M.getName();
+  StringRef FileName = M.getName();
+  if (DIFile *DIF = DIL->getFile())
+if (Optional Source = DIF->getSource())
+  FileName = *Source;
   StringRef Function = DIL->getScope()->getSubprogram()->getName();
   Function =
   !Function.empty() ? Function : Loc.IP.getBlock()->getParent()->getName();
Index: clang/test/OpenMP/irbuilder_nested_parallel_for.c
===
--- clang/test/OpenMP/irbuilder_nested_parallel_for.c
+++ clang/test/OpenMP/irbuilder_nested_parallel_for.c
@@ -11,10 +11,10 @@
 
 // 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:[[OMP_GLOBAL_THREAD_NUM:%.*]] = call i32 @__kmpc_global_thread_num(%struct.ident_t* [[GLOB1:@.*]])
 // 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: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*)* @_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:%.*]]
@@ -23,15 +23,15 @@
 //
 // 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 !{{[0-9]*}}
+// CHECK-DEBUG-NEXT:[[OMP_GLOBAL_THREAD_NUM:%.*]] = call i32 @__kmpc_global_thread_num(%struct.ident_t* [[GLOB1:@.*]]), [[DBG10:!dbg !.*]]
 // 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 !{{[0-9]*}}
+// CHECK-DEBUG-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*)* @_Z14parallel_for_0v..omp_par to void (i32*, i32*, ...)*)), [[DBG11:!dbg !.*]]
 // 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 !{{[0-9]*}}
+// CHECK-DEBUG-NEXT:ret void, [[DBG14:!dbg !.*]]
 //
 void parallel_for_0(void) {
 #pragma omp parallel
@@ -50,10 +50,10 @@
 // CHECK-NEXT:store float* [[R:%.*]], float** [[R_ADDR]], align 8
 // CHECK-NEXT:store i32 [[A:%.*]], i32* [[A_ADDR]], align 4
 // 

[PATCH] D85938: [OpenMP][NFC] Update check lines after D85099

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

Root cause:
We sometimes, depending on the invocation and potentially other factors, use a 
full path and sometimes not:
So wen I run this with clang locally I get this:

  @98 = private unnamed_addr constant [98 x i8] 
c";/data/src/llvm-project/clang/test/OpenMP/irbuilder_nested_parallel_for.c;parallel_for_2;294;16;;\00",
 align 1
   
  @100 = private unnamed_addr constant %struct.ident_t { i32 0, i32 2, i32 0, 
i32 0, i8* getelementptr inbounds ([98 x i8], [98 x i8]* @98, i32 0, i32 0) }, 
align 8
  @101 = private unnamed_addr constant [92 x i8] 
c";src/llvm-project/clang/test/OpenMP/irbuilder_nested_parallel_for.c;parallel_for_2;294;16;;\00",
 align 1
  @103 = private unnamed_addr constant %struct.ident_t { i32 0, i32 2, i32 0, 
i32 0, i8* getelementptr inbounds ([92 x i8], [92 x i8]* @101, i32 0, i32 0) }, 
align 8

Note the 6 missing characters `/data/` in the second string. Because they are 
missing, we generate two globals for this. When I run the same test with the 
update script I get one global as they agree on the location.

Looking for the location that strips the path now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85938

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


[PATCH] D85938: [OpenMP][NFC] Update check lines after D85099

2020-08-13 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast added a comment.

In D85938#2216905 , @lebedev.ri wrote:

> Thanks. Seems to fix the test for me FWIW, but
>
> 1. why wasn't this caught by anyone and all of the bots?

For what it's worth, I have been affected by this and was drafting a note to 
D82822  today to ask about the status.

> 2. what is the actual underlying problem, if any?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85938

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


[PATCH] D85938: [OpenMP][NFC] Update check lines after D85099

2020-08-13 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert planned changes to this revision.
jdoerfert added a comment.

Something is fishy here. Now the pre-merge tests fail... this should accept 
strictly more... I have to look into this, best guess: some non-determinism


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85938

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


[PATCH] D85938: [OpenMP][NFC] Update check lines after D85099

2020-08-13 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri accepted this revision.
lebedev.ri added a comment.
This revision is now accepted and ready to land.

Thanks. Seems to fix the test for me FWIW, but

1. why wasn't this caught by anyone and all of the bots?
2. what is the actual underlying problem, if any?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85938

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


[PATCH] D85938: [OpenMP][NFC] Update check lines after D85099

2020-08-13 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert created this revision.
jdoerfert added a reviewer: lebedev.ri.
Herald added subscribers: guansong, bollu, yaxunl.
Herald added a project: clang.
jdoerfert requested review of this revision.
Herald added a subscriber: sstefan1.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85938

Files:
  clang/test/OpenMP/irbuilder_nested_parallel_for.c

Index: clang/test/OpenMP/irbuilder_nested_parallel_for.c
===
--- clang/test/OpenMP/irbuilder_nested_parallel_for.c
+++ clang/test/OpenMP/irbuilder_nested_parallel_for.c
@@ -11,10 +11,10 @@
 
 // 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:[[OMP_GLOBAL_THREAD_NUM:%.*]] = call i32 @__kmpc_global_thread_num(%struct.ident_t* [[GLOB1:@.*]])
 // 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: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*)* @_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:%.*]]
@@ -23,15 +23,15 @@
 //
 // 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 !{{[0-9]*}}
+// CHECK-DEBUG-NEXT:[[OMP_GLOBAL_THREAD_NUM:%.*]] = call i32 @__kmpc_global_thread_num(%struct.ident_t* [[GLOB1:@.*]]), [[DBG10:!dbg !.*]]
 // 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 !{{[0-9]*}}
+// CHECK-DEBUG-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*)* @_Z14parallel_for_0v..omp_par to void (i32*, i32*, ...)*)), [[DBG11:!dbg !.*]]
 // 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 !{{[0-9]*}}
+// CHECK-DEBUG-NEXT:ret void, [[DBG14:!dbg !.*]]
 //
 void parallel_for_0(void) {
 #pragma omp parallel
@@ -50,10 +50,10 @@
 // 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:[[OMP_GLOBAL_THREAD_NUM:%.*]] = call i32 @__kmpc_global_thread_num(%struct.ident_t* [[GLOB1]])
 // 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:call void (%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(%struct.ident_t* [[GLOB1]], 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:%.*]]
@@ -66,20 +66,20 @@
 // 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]], align 8
-// CHECK-DEBUG-NEXT:call void @llvm.dbg.declare(metadata float** [[R_ADDR]], metadata !{{[0-9]*}}, metadata !DIExpression()), !dbg !{{[0-9]*}}
+// CHECK-DEBUG-NEXT:call void @llvm.dbg.declare(metadata float** [[R_ADDR]], [[META41:metadata !.*]], metadata !DIExpression()), [[DBG42:!dbg !.*]]
 // CHECK-DEBUG-NEXT:store i32 [[A:%.*]], i32* [[A_ADDR]], align 4
-// CHECK-DEBUG-NEXT:call void