Skip to content

Commit 6821a6e

Browse files
committed
fix tests
1 parent 3b0e3dd commit 6821a6e

File tree

4 files changed

+82
-14
lines changed

4 files changed

+82
-14
lines changed

mlir/lib/Pass/Pass.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,11 @@ void Pass::printAsTextualPipeline(raw_ostream &os, bool pretty) {
8888
llvm::interleave(
8989
adaptor->getPassManagers(),
9090
[&](OpPassManager &pm) { pm.printAsTextualPipeline(os, pretty); },
91-
[&] { os << ","; });
91+
[&] {
92+
os << ",";
93+
if (pretty)
94+
os << "\n";
95+
});
9296
return;
9397
}
9498
// Otherwise, print the pass argument followed by its options. If the pass
@@ -402,7 +406,7 @@ void printAsTextualPipeline(
402406
os.indent();
403407
}
404408
llvm::interleave(
405-
passes, [&](mlir::Pass &pass) { pass.printAsTextualPipeline(os); },
409+
passes, [&](mlir::Pass &pass) { pass.printAsTextualPipeline(os, pretty); },
406410
[&]() {
407411
os << ",";
408412
if (pretty)
@@ -416,9 +420,9 @@ void printAsTextualPipeline(
416420
}
417421
void printAsTextualPipeline(
418422
raw_ostream &os, StringRef anchorName,
419-
const llvm::iterator_range<OpPassManager::pass_iterator> &passes) {
423+
const llvm::iterator_range<OpPassManager::pass_iterator> &passes, bool pretty) {
420424
raw_indented_ostream indentedOS(os);
421-
printAsTextualPipeline(indentedOS, anchorName, passes);
425+
printAsTextualPipeline(indentedOS, anchorName, passes, pretty);
422426
}
423427
void OpPassManager::printAsTextualPipeline(raw_ostream &os, bool pretty) const {
424428
StringRef anchorName = getOpAnchorName();

mlir/lib/Pass/PassCrashRecovery.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,8 @@ makeReproducerStreamFactory(StringRef outputFile) {
443443

444444
void printAsTextualPipeline(
445445
raw_ostream &os, StringRef anchorName,
446-
const llvm::iterator_range<OpPassManager::pass_iterator> &passes);
446+
const llvm::iterator_range<OpPassManager::pass_iterator> &passes,
447+
bool pretty = false);
447448

448449
std::string mlir::makeReproducer(
449450
StringRef anchorName,

mlir/test/Pass/pipeline-options-parsing.mlir

Lines changed: 68 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,71 @@
3838

3939
// CHECK_1: test-options-pass{enum=zero list={1,2,3,4,5} string=nested_pipeline{arg1=10 arg2=" {} " arg3=true} string-list={a,b,c,d}}
4040
// CHECK_2: test-options-pass{enum=one list={1} string= string-list={a,b}}
41-
// CHECK_3: builtin.module(builtin.module(func.func(test-options-pass{enum=zero list={3} string= }),func.func(test-options-pass{enum=one list={1,2,3,4} string= })))
42-
// CHECK_4: builtin.module(builtin.module(func.func(test-options-pass{enum=zero list={3} string= }),func.func(test-options-pass{enum=one list={1,2,3,4} string=foobar })))
43-
// CHECK_5: builtin.module(builtin.module(func.func(test-options-pass{enum=zero list={3} string= }),func.func(test-options-pass{enum=one list={1,2,3,4} string={foo bar baz} })))
44-
// CHECK_6: builtin.module(builtin.module(func.func(test-options-pass{enum=zero list={3} string= }),func.func(test-options-pass{enum=one list={1,2,3,4} string=foo"bar"baz })))
45-
// CHECK_7{LITERAL}: builtin.module(func.func(test-options-super-pass{list={{enum=zero list={1} string=foo },{enum=one list={2} string=bar },{enum=two list={3} string=baz }}}))
46-
// CHECK_8{LITERAL}: builtin.module(func.func(test-options-super-pass{list={{enum=zero list={1} string=foo },{enum=one string=bar }}}))
47-
// CHECK_9: builtin.module(func.func(test-options-pass{enum=zero string= string-list={}}))
48-
// CHECK_10: builtin.module(func.func(test-options-pass{enum=zero string= string-list={,}}))
41+
42+
// CHECK_3: builtin.module(
43+
// CHECK_3-NEXT: builtin.module(
44+
// CHECK_3-NEXT: func.func(
45+
// CHECK_3-NEXT: test-options-pass{enum=zero list={3} string= }
46+
// CHECK_3-NEXT: ),
47+
// CHECK_3-NEXT: func.func(
48+
// CHECK_3-NEXT: test-options-pass{enum=one list={1,2,3,4} string= }
49+
// CHECK_3-NEXT: )
50+
// CHECK_3-NEXT: )
51+
// CHECK_3-NEXT: )
52+
53+
// CHECK_4: builtin.module(
54+
// CHECK_4-NEXT: builtin.module(
55+
// CHECK_4-NEXT: func.func(
56+
// CHECK_4-NEXT: test-options-pass{enum=zero list={3} string= }
57+
// CHECK_4-NEXT: ),
58+
// CHECK_4-NEXT: func.func(
59+
// CHECK_4-NEXT: test-options-pass{enum=one list={1,2,3,4} string=foobar }
60+
// CHECK_4-NEXT: )
61+
// CHECK_4-NEXT: )
62+
// CHECK_4-NEXT: )
63+
64+
// CHECK_5: builtin.module(
65+
// CHECK_5-NEXT: builtin.module(
66+
// CHECK_5-NEXT: func.func(
67+
// CHECK_5-NEXT: test-options-pass{enum=zero list={3} string= }
68+
// CHECK_5-NEXT: ),
69+
// CHECK_5-NEXT: func.func(
70+
// CHECK_5-NEXT: test-options-pass{enum=one list={1,2,3,4} string={foo bar baz} }
71+
// CHECK_5-NEXT: )
72+
// CHECK_5-NEXT: )
73+
// CHECK_5-NEXT: )
74+
75+
// CHECK_6: builtin.module(
76+
// CHECK_6-NEXT: builtin.module(
77+
// CHECK_6-NEXT: func.func(
78+
// CHECK_6-NEXT: test-options-pass{enum=zero list={3} string= }
79+
// CHECK_6-NEXT: ),
80+
// CHECK_6-NEXT: func.func(
81+
// CHECK_6-NEXT: test-options-pass{enum=one list={1,2,3,4} string=foo"bar"baz }
82+
// CHECK_6-NEXT: )
83+
// CHECK_6-NEXT: )
84+
// CHECK_6-NEXT: )
85+
86+
// CHECK_7{LITERAL}: builtin.module(
87+
// CHECK_7{LITERAL}-NEXT: func.func(
88+
// CHECK_7{LITERAL}-NEXT: test-options-super-pass{list={{enum=zero list={1} string=foo },{enum=one list={2} string=bar },{enum=two list={3} string=baz }}}
89+
// CHECK_7{LITERAL}-NEXT: )
90+
// CHECK_7{LITERAL}-NEXT: )
91+
92+
// CHECK_8{LITERAL}: builtin.module(
93+
// CHECK_8{LITERAL}-NEXT: func.func(
94+
// CHECK_8{LITERAL}-NEXT: test-options-super-pass{list={{enum=zero list={1} string=foo },{enum=one string=bar }}}
95+
// CHECK_8{LITERAL}-NEXT: )
96+
// CHECK_8{LITERAL}-NEXT: )
97+
98+
// CHECK_9: builtin.module(
99+
// CHECK_9-NEXT: func.func(
100+
// CHECK_9-NEXT: test-options-pass{enum=zero string= string-list={}}
101+
// CHECK_9-NEXT: )
102+
// CHECK_9-NEXT: )
103+
104+
// CHECK_10: builtin.module(
105+
// CHECK_10-NEXT: func.func(
106+
// CHECK_10-NEXT: test-options-pass{enum=zero string= string-list={,}}
107+
// CHECK_10-NEXT: )
108+
// CHECK_10-NEXT: )

mlir/test/Pass/run-reproducer.mlir

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ func.func @bar() {
1515
mlir_reproducer: {
1616
verify_each: true,
1717
// CHECK: builtin.module(
18-
// CHECK-NEXT: func.func(cse,canonicalize{ max-iterations=1 max-num-rewrites=-1 region-simplify=normal test-convergence=false top-down=false})
18+
// CHECK-NEXT: func.func(
19+
// CHECK-NEXT: cse,
20+
// CHECK-NEXT: canonicalize{ max-iterations=1 max-num-rewrites=-1 region-simplify=normal test-convergence=false top-down=false}
21+
// CHECK-NEXT: )
1922
// CHECK-NEXT: )
2023
pipeline: "builtin.module(func.func(cse,canonicalize{max-iterations=1 max-num-rewrites=-1 region-simplify=normal top-down=false}))",
2124
disable_threading: true

0 commit comments

Comments
 (0)