Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/tools/optimization-options.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ struct OptimizationOptions : public ToolOptions {
"-sp",
"Skip a pass (do not run it)",
OptimizationOptionsCategory,
Options::Arguments::One,
Options::Arguments::N,
[this](Options*, const std::string& pass) {
passOptions.passesToSkip.insert(pass);
});
Expand Down
65 changes: 65 additions & 0 deletions test/lit/passes/O1_skip_passes.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited.

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

;; Check that we can skip several passes. Note that no local.tee is introduced.

(module
;; CHECK: (import "a" "b" (func $log (param i32 i32)))
(import "a" "b" (func $log (param i32 i32)))

;; CHECK: (func $foo (param $p i32)
;; CHECK-NEXT: (local $x i32)
;; CHECK-NEXT: (local $y i32)
;; CHECK-NEXT: (local.set $x
;; CHECK-NEXT: (i32.add
;; CHECK-NEXT: (local.get $p)
;; CHECK-NEXT: (i32.const 1)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (call $log
;; CHECK-NEXT: (local.get $x)
;; CHECK-NEXT: (local.get $x)
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $y
;; CHECK-NEXT: (i32.add
;; CHECK-NEXT: (local.get $p)
;; CHECK-NEXT: (i32.const 1)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (call $log
;; CHECK-NEXT: (local.get $y)
;; CHECK-NEXT: (local.get $y)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $foo (export "foo") (param $p i32)
;; The locals $x and $y can be coalesced into a single local, but as
;; we do not run that pass, they will not be. They could be
;; initialized using a tee but the passes that introduce tees are
;; not run either.
(local $x i32)
(local $y i32)

(local.set $x
(i32.add
(local.get $p)
(i32.const 1)
)
)
(call $log
(local.get $x)
(local.get $x)
)

(local.set $y
(i32.add
(local.get $p)
(i32.const 1)
)
)
(call $log
(local.get $y)
(local.get $y)
)
)
)