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
1,417 changes: 1,417 additions & 0 deletions test/lit/passes/dce_all-features.wast

Large diffs are not rendered by default.

82 changes: 82 additions & 0 deletions test/lit/passes/dce_vacuum_remove-unused-names.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
;; NOTE: This test was ported using port_test.py and could be cleaned up.

;; RUN: foreach %s %t wasm-opt --dce --vacuum --remove-unused-names -S -o - | filecheck %s

(module
;; CHECK: (type $none_=>_i32 (func (result i32)))

;; CHECK: (type $f32_f32_=>_f32 (func (param f32 f32) (result f32)))

;; CHECK: (type $i64_=>_i64 (func (param i64) (result i64)))

;; CHECK: (func $__Z12serveroptionPc (result i32)
;; CHECK-NEXT: (return
;; CHECK-NEXT: (i32.const 0)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $__Z12serveroptionPc (result i32)
(block $switch$0
(return
(i32.const 0)
)
(br $switch$0)
)
(return
(i32.const 0)
)
)
;; CHECK: (func $drop-unreachable (param $var$0 f32) (param $var$1 f32) (result f32)
;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
(func $drop-unreachable (param $var$0 f32) (param $var$1 f32) (result f32)
(block $label$0 (result f32)
(loop $label$2
(drop
(unreachable)
)
(unreachable)
)
(local.get $var$1)
)
)

;; CHECK: (func $set-unreachable (param $var$0 i64) (result i64)
;; CHECK-NEXT: (local $var$1 i64)
;; CHECK-NEXT: (local $var$2 i64)
;; CHECK-NEXT: (if
;; CHECK-NEXT: (i64.eq
;; CHECK-NEXT: (local.get $var$1)
;; CHECK-NEXT: (i64.const 0)
;; CHECK-NEXT: )
;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $set-unreachable (param $var$0 i64) (result i64)
(local $var$1 i64)
(local $var$2 i64)
(block $label$0 (result i64)
(block $label$1
(loop $label$2
(if
(i64.eq
(local.get $var$1)
(i64.const 0)
)
(unreachable)
(local.set $var$2
(i64.mul
(unreachable)
(local.get $var$2)
)
)
)
(br $label$2)
)
)
(local.get $var$2)
)
)
)

48 changes: 48 additions & 0 deletions test/lit/passes/dealign.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
;; NOTE: This test was ported using port_test.py and could be cleaned up.

;; RUN: foreach %s %t wasm-opt --dealign -S -o - | filecheck %s

(module
;; CHECK: (type $none_=>_none (func))

;; CHECK: (memory $0 1 1)
(memory $0 1 1)
;; CHECK: (func $test
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (i32.load align=1
;; CHECK-NEXT: (i32.const 4)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (i32.load align=1
;; CHECK-NEXT: (i32.const 8)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (i32.load align=1
;; CHECK-NEXT: (i32.const 12)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (i32.store align=1
;; CHECK-NEXT: (i32.const 16)
;; CHECK-NEXT: (i32.const 28)
;; CHECK-NEXT: )
;; CHECK-NEXT: (i32.store align=1
;; CHECK-NEXT: (i32.const 20)
;; CHECK-NEXT: (i32.const 32)
;; CHECK-NEXT: )
;; CHECK-NEXT: (i32.store align=1
;; CHECK-NEXT: (i32.const 24)
;; CHECK-NEXT: (i32.const 36)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $test
(drop (i32.load (i32.const 4)))
(drop (i32.load align=1 (i32.const 8)))
(drop (i32.load align=2 (i32.const 12)))
(i32.store (i32.const 16) (i32.const 28))
(i32.store align=1 (i32.const 20) (i32.const 32))
(i32.store align=2 (i32.const 24) (i32.const 36))
)
)
48 changes: 48 additions & 0 deletions test/lit/passes/dealign64.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
;; NOTE: This test was ported using port_test.py and could be cleaned up.

;; RUN: foreach %s %t wasm-opt --dealign --enable-memory64 -S -o - | filecheck %s

(module
;; CHECK: (type $none_=>_none (func))

;; CHECK: (memory $0 i64 1 1)
(memory $0 i64 1 1)
;; CHECK: (func $test
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (i32.load align=1
;; CHECK-NEXT: (i64.const 4)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (i32.load align=1
;; CHECK-NEXT: (i64.const 8)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (i32.load align=1
;; CHECK-NEXT: (i64.const 12)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (i32.store align=1
;; CHECK-NEXT: (i64.const 16)
;; CHECK-NEXT: (i32.const 28)
;; CHECK-NEXT: )
;; CHECK-NEXT: (i32.store align=1
;; CHECK-NEXT: (i64.const 20)
;; CHECK-NEXT: (i32.const 32)
;; CHECK-NEXT: )
;; CHECK-NEXT: (i32.store align=1
;; CHECK-NEXT: (i64.const 24)
;; CHECK-NEXT: (i32.const 36)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $test
(drop (i32.load (i64.const 4)))
(drop (i32.load align=1 (i64.const 8)))
(drop (i32.load align=2 (i64.const 12)))
(i32.store (i64.const 16) (i32.const 28))
(i32.store align=1 (i64.const 20) (i32.const 32))
(i32.store align=2 (i64.const 24) (i32.const 36))
)
)
Loading