diff options
author | Heejin Ahn <aheejin@gmail.com> | 2019-07-26 19:04:45 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-26 19:04:45 -0700 |
commit | edf001feb62d32c76f20d5564fabfab93035afdf (patch) | |
tree | bda476b9243bde99b59c2c770528ce476904f03b /test | |
parent | ccd95f8f5725a8d52557772b3081875babda312f (diff) | |
download | binaryen-edf001feb62d32c76f20d5564fabfab93035afdf.tar.gz binaryen-edf001feb62d32c76f20d5564fabfab93035afdf.tar.bz2 binaryen-edf001feb62d32c76f20d5564fabfab93035afdf.zip |
Fix unreachable prefix in instruction printing (#2265)
When a memory instruction's type is unreachable, i.e., one of its
child expressions is unreachable, the instruction will be printed like
`unreachable.load`, which is invalid text format.
This prints unreachable prefix instruction types as `i32` to just make
them pass the parser. It is OK because they are not reachable anyway.
Also this removes printing of `?` in atomic.rmw instruction printing.
Diffstat (limited to 'test')
-rw-r--r-- | test/passes/alignment-lowering.txt | 2 | ||||
-rw-r--r-- | test/passes/flatten.txt | 4 | ||||
-rw-r--r-- | test/passes/remove-unused-brs.txt | 2 | ||||
-rw-r--r-- | test/unreachable-instr-type.wast | 28 | ||||
-rw-r--r-- | test/unreachable-instr-type.wast.from-wast | 27 | ||||
-rw-r--r-- | test/unreachable-instr-type.wast.fromBinary | 8 | ||||
-rw-r--r-- | test/unreachable-instr-type.wast.fromBinary.noDebugInfo | 8 |
7 files changed, 75 insertions, 4 deletions
diff --git a/test/passes/alignment-lowering.txt b/test/passes/alignment-lowering.txt index dd8d8ca9c..61066dc54 100644 --- a/test/passes/alignment-lowering.txt +++ b/test/passes/alignment-lowering.txt @@ -437,7 +437,7 @@ ) ) (drop - (unreachable.load offset=100 + (i32.load offset=100 (unreachable) ) ) diff --git a/test/passes/flatten.txt b/test/passes/flatten.txt index 7cfd1e6a7..5fc0a1032 100644 --- a/test/passes/flatten.txt +++ b/test/passes/flatten.txt @@ -679,7 +679,7 @@ (drop (unreachable) ) - (unreachable.load + (i32.load (unreachable) ) (unreachable) @@ -1183,7 +1183,7 @@ (i32.const 22) (block (unreachable) - (unreachable.load + (i32.load (unreachable) ) (drop diff --git a/test/passes/remove-unused-brs.txt b/test/passes/remove-unused-brs.txt index 790d943c3..0cfa94f6c 100644 --- a/test/passes/remove-unused-brs.txt +++ b/test/passes/remove-unused-brs.txt @@ -984,7 +984,7 @@ (i32.const 607395945) ) (br_if $label$1 - (unreachable.load offset=3 align=1 + (i32.load offset=3 align=1 (select (call $untaken-brs-might-prevent-block-removal (f32.const 1.4904844647389837e-07) diff --git a/test/unreachable-instr-type.wast b/test/unreachable-instr-type.wast new file mode 100644 index 000000000..220347f0f --- /dev/null +++ b/test/unreachable-instr-type.wast @@ -0,0 +1,28 @@ +(module + (memory (shared 1 1)) + (func $test + (f32.load (unreachable)) + + (f32.store + (unreachable) + (f32.const 0) + ) + + (i64.atomic.rmw.add + (unreachable) + (i64.const 0) + ) + + (i64.atomic.rmw.cmpxchg + (unreachable) + (i64.const 0) + (i64.const 1) + ) + + (i64.atomic.wait + (unreachable) + (i64.const 0) + (i64.const 0) + ) + ) +) diff --git a/test/unreachable-instr-type.wast.from-wast b/test/unreachable-instr-type.wast.from-wast new file mode 100644 index 000000000..2e3a87b49 --- /dev/null +++ b/test/unreachable-instr-type.wast.from-wast @@ -0,0 +1,27 @@ +(module + (type $FUNCSIG$v (func)) + (memory $0 (shared 1 1)) + (func $test (; 0 ;) (type $FUNCSIG$v) + (i32.load + (unreachable) + ) + (f32.store + (unreachable) + (f32.const 0) + ) + (i32.atomic.rmw.add + (unreachable) + (i64.const 0) + ) + (i32.atomic.rmw.cmpxchg + (unreachable) + (i64.const 0) + (i64.const 1) + ) + (i64.atomic.wait + (unreachable) + (i64.const 0) + (i64.const 0) + ) + ) +) diff --git a/test/unreachable-instr-type.wast.fromBinary b/test/unreachable-instr-type.wast.fromBinary new file mode 100644 index 000000000..32838581a --- /dev/null +++ b/test/unreachable-instr-type.wast.fromBinary @@ -0,0 +1,8 @@ +(module + (type $0 (func)) + (memory $0 (shared 1 1)) + (func $test (; 0 ;) (type $0) + (unreachable) + ) +) + diff --git a/test/unreachable-instr-type.wast.fromBinary.noDebugInfo b/test/unreachable-instr-type.wast.fromBinary.noDebugInfo new file mode 100644 index 000000000..16237ef69 --- /dev/null +++ b/test/unreachable-instr-type.wast.fromBinary.noDebugInfo @@ -0,0 +1,8 @@ +(module + (type $0 (func)) + (memory $0 (shared 1 1)) + (func $0 (; 0 ;) (type $0) + (unreachable) + ) +) + |