Skip to content

Commit 720d644

Browse files
authored
Avoid spurious warnings in pass skipping (#5451)
Nested runners should be ignored, as they run some internal stuff in certain passes, which would not contain the pass the user asked to skip with --skip-pass.
1 parent 48c8615 commit 720d644

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

src/passes/pass.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -816,13 +816,17 @@ void PassRunner::run() {
816816
flush();
817817
}
818818

819-
// All the passes the user requested to skip should have been seen, and
820-
// skipped. If not, the user may have had a typo in the name of a pass to
821-
// skip, and we will warn.
822-
for (auto pass : options.passesToSkip) {
823-
if (!skippedPasses.count(pass)) {
824-
std::cerr << "warning: --" << pass << " was requested to be skipped, "
825-
<< "but it was not found in the passes that were run.\n";
819+
if (!isNested) {
820+
// All the passes the user requested to skip should have been seen, and
821+
// skipped. If not, the user may have had a typo in the name of a pass to
822+
// skip, and we will warn. (We don't do this in a nested runner because
823+
// those are used for various internal tasks inside passes, which would lead
824+
// to many spurious warnings.)
825+
for (auto pass : options.passesToSkip) {
826+
if (!skippedPasses.count(pass)) {
827+
std::cerr << "warning: --" << pass << " was requested to be skipped, "
828+
<< "but it was not found in the passes that were run.\n";
829+
}
826830
}
827831
}
828832
}

test/lit/passes/O1_skip.wast

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
22
;; NOTE: This test was ported using port_passes_tests_to_lit.py and could be cleaned up.
33

4-
;; RUN: foreach %s %t wasm-opt -O2 --coalesce-locals --skip-pass=coalesce-locals -S -o - | filecheck %s
4+
;; RUN: foreach %s %t wasm-opt -O2 --coalesce-locals --skip-pass=coalesce-locals -S -o - 2>&1 | filecheck %s
55

66
;; We should skip coalese-locals even though it is run in -O2 and also we ask to
77
;; run it directly: the skip instruction overrides everything else.
88

9+
;; There should also be no warning in the output.
10+
;; CHECK-NOT: warning:
11+
912
(module
1013
;; CHECK: (type $i32_i32_=>_none (func (param i32 i32)))
1114

0 commit comments

Comments
 (0)