summaryrefslogtreecommitdiff
path: root/test/passes/simplify-locals-nostructure.wast
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2017-08-18 13:58:14 -0700
committerGitHub <noreply@github.com>2017-08-18 13:58:14 -0700
commite5e77281ca516b7b802eb6c9b4bc3b39e2a8201e (patch)
treeb7330ab3e5e956f82c795ef40b33365d091fdc3e /test/passes/simplify-locals-nostructure.wast
parent229764b0d52bce0d0e973c96b9bdb686e4ec1f1e (diff)
downloadbinaryen-e5e77281ca516b7b802eb6c9b4bc3b39e2a8201e.tar.gz
binaryen-e5e77281ca516b7b802eb6c9b4bc3b39e2a8201e.tar.bz2
binaryen-e5e77281ca516b7b802eb6c9b4bc3b39e2a8201e.zip
Don't reorder an implicit trap with a global side effect (#1133)
Diffstat (limited to 'test/passes/simplify-locals-nostructure.wast')
-rw-r--r--test/passes/simplify-locals-nostructure.wast33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/passes/simplify-locals-nostructure.wast b/test/passes/simplify-locals-nostructure.wast
index 548109237..9a4a63a2e 100644
--- a/test/passes/simplify-locals-nostructure.wast
+++ b/test/passes/simplify-locals-nostructure.wast
@@ -36,5 +36,38 @@
)
)
)
+ (func $implicit-trap-and-global-effects
+ (local $var$0 i32)
+ (set_local $var$0
+ (i32.trunc_u/f64
+ (f64.const -nan:0xfffffffffffc3) ;; this implicit trap will actually trap
+ )
+ )
+ (f32.store align=1 ;; and if we move it across this store, the store will execute, having global side effects
+ (i32.const 22)
+ (f32.const 154)
+ )
+ (drop
+ (get_local $var$0)
+ )
+ )
+ (func $implicit-trap-and-local-effects
+ (local $var$0 i32)
+ (local $other i32)
+ (set_local $var$0
+ (i32.trunc_u/f64
+ (f64.const -nan:0xfffffffffffc3) ;; this implicit trap will actually trap
+ )
+ )
+ (set_local $other (i32.const 100)) ;; but it's fine to move it across a local effect, that vanishes anyhow
+ (drop
+ (get_local $var$0)
+ )
+ (if (i32.const 1)
+ (drop
+ (get_local $other)
+ )
+ )
+ )
)