[polly] cc871cf - [Polly][Test] Fix race condition while printing dot files.

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Thu May 26 13:59:07 PDT 2022


Author: Michael Kruse
Date: 2022-05-26T15:58:53-05:00
New Revision: cc871cf6b50f6a76f2083d192e2254a16832224b

URL: https://github.com/llvm/llvm-project/commit/cc871cf6b50f6a76f2083d192e2254a16832224b
DIFF: https://github.com/llvm/llvm-project/commit/cc871cf6b50f6a76f2083d192e2254a16832224b.diff

LOG: [Polly][Test] Fix race condition while printing dot files.

The tests dot-scops.ll and dot-scops-npm.ll both wrote to the same file
scops.func.dot. If they are executed in parallel they will race for
the file. Fix by renaming func to func_npm in dot-scops-npm.ll so this
test writes dot scops.func_npm.dot.

Long-term, we will probably pass a file name (prefix) to the
printer pass such that we can use the guaranteed-unique LIT %t
placeholder in tests.

Added: 
    

Modified: 
    polly/test/ScopDetect/dot-scops-npm.ll
    polly/test/ScopDetect/dot-scops.ll

Removed: 
    


################################################################################
diff  --git a/polly/test/ScopDetect/dot-scops-npm.ll b/polly/test/ScopDetect/dot-scops-npm.ll
index 3911d0fb97cff..c426d0209694d 100644
--- a/polly/test/ScopDetect/dot-scops-npm.ll
+++ b/polly/test/ScopDetect/dot-scops-npm.ll
@@ -1,15 +1,20 @@
 ; RUN: opt %loadNPMPolly "-passes=polly-scop-printer" -disable-output < %s
-; RUN: FileCheck %s -input-file=scops.func.dot
+; RUN: FileCheck %s -input-file=scops.func_npm.dot
 ;
 ; Check that the ScopPrinter does not crash.
 ; ScopPrinter needs the ScopDetection pass, which should depend on
 ; ScalarEvolution transitively.
+;
+; FIXME: polly-scop-printer always prints to the same hardcoded filename
+;        scops.<functionname>.dot. If there is another test with the same
+;        function name and printing a dot file there will be a race condition
+;        when running tests in parallel.
 
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 
-define void @func(i32 %n, i32 %m, double* noalias nonnull %A) {
-; CHECK:      digraph "Scop Graph for 'func' function"
-; CHECK-NEXT: label="Scop Graph for 'func' function"
+define void @func_npm(i32 %n, i32 %m, double* noalias nonnull %A) {
+; CHECK:      digraph "Scop Graph for 'func_npm' function"
+; CHECK-NEXT: label="Scop Graph for 'func_npm' function"
 ; CHECK:      Node0x[[EntryID:.*]] [shape=record,label="{entry:\l  br label %outer.for\l}"];
 ; CHECK-NEXT: Node0x[[EntryID]] -> Node0x[[OUTER_FOR_ID:.*]];
 ; CHECK-NEXT: Node0x[[OUTER_FOR_ID]] [shape=record,label="{outer.for:

diff  --git a/polly/test/ScopDetect/dot-scops.ll b/polly/test/ScopDetect/dot-scops.ll
index 3b26d6c9464e2..590f222c4690b 100644
--- a/polly/test/ScopDetect/dot-scops.ll
+++ b/polly/test/ScopDetect/dot-scops.ll
@@ -3,6 +3,11 @@
 ; Check that the ScopPrinter does not crash.
 ; ScopPrinter needs the ScopDetection pass, which should depend on
 ; ScalarEvolution transitively.
+;
+; FIXME: -dot-scops always prints to the same hardcoded filename
+;        scops.<functionname>.dot. If there is another test with the same
+;        function name and printing a dot file there will be a race condition
+;        when running tests in parallel.
 
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 


        


More information about the llvm-commits mailing list