diff options
author | Alon Zakai <azakai@google.com> | 2024-02-07 17:20:22 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-07 17:20:22 -0800 |
commit | 4e0796d022fcd48c8af5a8a709577ce495bca991 (patch) | |
tree | 8ca814907b2719379f65b7592d78487feb81aaa7 /test/lit/passes/simplify-globals-nested.wast | |
parent | d4c3fddd3de605983398756d3b46e2f14e55aba2 (diff) | |
download | binaryen-4e0796d022fcd48c8af5a8a709577ce495bca991.tar.gz binaryen-4e0796d022fcd48c8af5a8a709577ce495bca991.tar.bz2 binaryen-4e0796d022fcd48c8af5a8a709577ce495bca991.zip |
SimplifyGlobals: Propagate constant globals into nested gets in other globals (#6285)
Before we propagated to the top level, but not to anything interior.
Diffstat (limited to 'test/lit/passes/simplify-globals-nested.wast')
-rw-r--r-- | test/lit/passes/simplify-globals-nested.wast | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/lit/passes/simplify-globals-nested.wast b/test/lit/passes/simplify-globals-nested.wast new file mode 100644 index 000000000..925d71161 --- /dev/null +++ b/test/lit/passes/simplify-globals-nested.wast @@ -0,0 +1,27 @@ +;; 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 --simplify-globals -all -S -o - | filecheck %s + +;; Test that we propagate globals into nested children of other globals. + +(module + ;; CHECK: (type $struct (struct (field i32) (field i32))) + (type $struct (struct i32 i32)) + + ;; CHECK: (global $a i32 (i32.const 42)) + (global $a i32 (i32.const 42)) + + ;; CHECK: (global $b i32 (i32.const 1337)) + (global $b i32 (i32.const 1337)) + + ;; CHECK: (global $struct (ref $struct) (struct.new $struct + ;; CHECK-NEXT: (i32.const 42) + ;; CHECK-NEXT: (i32.const 1337) + ;; CHECK-NEXT: )) + (global $struct (ref $struct) (struct.new $struct + (global.get $a) + (global.get $b) + )) +) + |