diff options
author | Alon Zakai <azakai@google.com> | 2020-07-28 11:12:15 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-28 11:12:15 -0700 |
commit | fceb216b9ad28dabc8c0fd5790b544d5d64acf64 (patch) | |
tree | b58a4300168a98a6708c95dfbf66c67c504dddcf /test | |
parent | 63d60fef3b07a343e21fb4bb8227c4e674633704 (diff) | |
download | binaryen-fceb216b9ad28dabc8c0fd5790b544d5d64acf64.tar.gz binaryen-fceb216b9ad28dabc8c0fd5790b544d5d64acf64.tar.bz2 binaryen-fceb216b9ad28dabc8c0fd5790b544d5d64acf64.zip |
AvoidReinterprets should not remove code around a reinterpret's value's fallthrough (#2989)
We can turn a reinterpret of a load into a different load, and so forth, but if
the reinterpret has a non-load child with a load fallthrough, that's not good
enough - we can't remove the extra code:
(reinterpret
(block
..extra code..
(load)
)
)
That can't be turned into a load of the flipped type.
Diffstat (limited to 'test')
-rw-r--r-- | test/passes/avoid-reinterprets.txt | 16 | ||||
-rw-r--r-- | test/passes/avoid-reinterprets.wast | 17 |
2 files changed, 33 insertions, 0 deletions
diff --git a/test/passes/avoid-reinterprets.txt b/test/passes/avoid-reinterprets.txt index 410132a84..d14484460 100644 --- a/test/passes/avoid-reinterprets.txt +++ b/test/passes/avoid-reinterprets.txt @@ -163,4 +163,20 @@ ) ) ) + (func $nofallthrough + (local $x i32) + (local.set $x + (i32.load + (i32.const 1024) + ) + ) + (drop + (f32.reinterpret_i32 + (block $block (result i32) + (nop) + (local.get $x) + ) + ) + ) + ) ) diff --git a/test/passes/avoid-reinterprets.wast b/test/passes/avoid-reinterprets.wast index 296b16df3..068df437c 100644 --- a/test/passes/avoid-reinterprets.wast +++ b/test/passes/avoid-reinterprets.wast @@ -49,4 +49,21 @@ ) ) ) + (func $nofallthrough + (local $x i32) + (local.set $x + (i32.load + (i32.const 1024) + ) + ) + (drop + (f32.reinterpret_i32 + (block (result i32) + (nop) ;; this would be removed by other opts, but in general, we can't + ;; just look at the fallthrough, as we can't just remove code here + (local.get $x) + ) + ) + ) + ) ) |