summaryrefslogtreecommitdiff
path: root/test/passes/Os_print-stack-ir_all-features_disable-gc.wast
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2021-07-22 09:11:12 -0700
committerGitHub <noreply@github.com>2021-07-22 09:11:12 -0700
commit556381b41aa95b56a77e9217afb2e2d7ecb230f5 (patch)
tree8bd8f1dd5083427e6c2024ea7af25ae487247b68 /test/passes/Os_print-stack-ir_all-features_disable-gc.wast
parented97c68294a8d95c57972eae22906cc0bea1aae8 (diff)
downloadbinaryen-556381b41aa95b56a77e9217afb2e2d7ecb230f5.tar.gz
binaryen-556381b41aa95b56a77e9217afb2e2d7ecb230f5.tar.bz2
binaryen-556381b41aa95b56a77e9217afb2e2d7ecb230f5.zip
[Wasm GC] Avoid dangerous StackIR opts on GC (#4007)
removeUnneededBlocks() can force us to use a local when we load the emitted wasm, which can't work for something nondefaultable like an RTT. For now, just don't run that optimization if GC is enabled. Eventually, perhaps we'll want to enable this optimization in a different way.
Diffstat (limited to 'test/passes/Os_print-stack-ir_all-features_disable-gc.wast')
-rw-r--r--test/passes/Os_print-stack-ir_all-features_disable-gc.wast16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/passes/Os_print-stack-ir_all-features_disable-gc.wast b/test/passes/Os_print-stack-ir_all-features_disable-gc.wast
new file mode 100644
index 000000000..5c03b5e23
--- /dev/null
+++ b/test/passes/Os_print-stack-ir_all-features_disable-gc.wast
@@ -0,0 +1,16 @@
+(module
+ (export "stacky-help" (func $stacky-help))
+ (func $stacky-help (param $x i32) (result i32)
+ (local $temp i32)
+ (i32.add
+ (call $stacky-help (i32.const 0))
+ (i32.eqz
+ (block (result i32) ;; after we use the stack instead of the local, we can remove this block
+ (local.set $temp (call $stacky-help (i32.const 1)))
+ (drop (call $stacky-help (i32.const 2)))
+ (local.get $temp)
+ )
+ )
+ )
+ )
+)