diff options
author | Alon Zakai <azakai@google.com> | 2023-01-25 13:10:57 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-25 13:10:57 -0800 |
commit | 720d64413af87518863bf481113702520bb81f7e (patch) | |
tree | d858149b8893e2555b343cf75d5c94390d00f984 | |
parent | 48c861523b21672a8ddb6216bab0e9e31b4abe7a (diff) | |
download | binaryen-720d64413af87518863bf481113702520bb81f7e.tar.gz binaryen-720d64413af87518863bf481113702520bb81f7e.tar.bz2 binaryen-720d64413af87518863bf481113702520bb81f7e.zip |
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.
-rw-r--r-- | src/passes/pass.cpp | 18 | ||||
-rw-r--r-- | test/lit/passes/O1_skip.wast | 5 |
2 files changed, 15 insertions, 8 deletions
diff --git a/src/passes/pass.cpp b/src/passes/pass.cpp index 593023c7c..13d700af9 100644 --- a/src/passes/pass.cpp +++ b/src/passes/pass.cpp @@ -816,13 +816,17 @@ void PassRunner::run() { flush(); } - // All the passes the user requested to skip should have been seen, and - // skipped. If not, the user may have had a typo in the name of a pass to - // skip, and we will warn. - for (auto pass : options.passesToSkip) { - if (!skippedPasses.count(pass)) { - std::cerr << "warning: --" << pass << " was requested to be skipped, " - << "but it was not found in the passes that were run.\n"; + if (!isNested) { + // All the passes the user requested to skip should have been seen, and + // skipped. If not, the user may have had a typo in the name of a pass to + // skip, and we will warn. (We don't do this in a nested runner because + // those are used for various internal tasks inside passes, which would lead + // to many spurious warnings.) + for (auto pass : options.passesToSkip) { + if (!skippedPasses.count(pass)) { + std::cerr << "warning: --" << pass << " was requested to be skipped, " + << "but it was not found in the passes that were run.\n"; + } } } } diff --git a/test/lit/passes/O1_skip.wast b/test/lit/passes/O1_skip.wast index c57d052b4..ebbf9df4a 100644 --- a/test/lit/passes/O1_skip.wast +++ b/test/lit/passes/O1_skip.wast @@ -1,11 +1,14 @@ ;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. ;; NOTE: This test was ported using port_passes_tests_to_lit.py and could be cleaned up. -;; RUN: foreach %s %t wasm-opt -O2 --coalesce-locals --skip-pass=coalesce-locals -S -o - | filecheck %s +;; RUN: foreach %s %t wasm-opt -O2 --coalesce-locals --skip-pass=coalesce-locals -S -o - 2>&1 | filecheck %s ;; We should skip coalese-locals even though it is run in -O2 and also we ask to ;; run it directly: the skip instruction overrides everything else. +;; There should also be no warning in the output. +;; CHECK-NOT: warning: + (module ;; CHECK: (type $i32_i32_=>_none (func (param i32 i32))) |