Skip to content

Commit 07ccba5

Browse files
authored
fix a dae fuzz bug (#2121)
1 parent d8c46cf commit 07ccba5

File tree

3 files changed

+105
-0
lines changed

3 files changed

+105
-0
lines changed

src/passes/DeadArgumentElimination.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,8 @@ struct DAE : public Pass {
217217
}
218218

219219
bool iteration(PassRunner* runner, Module* module) {
220+
allDroppedCalls.clear();
221+
220222
DAEFunctionInfoMap infoMap;
221223
// Ensure they all exist so the parallel threads don't modify the data
222224
// structure.

test/passes/dae-optimizing.txt

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
(module
2+
(type $0 (func (param f32) (result f32)))
3+
(type $1 (func (param f64 f32 f32 f64 f32 i64 f64) (result i32)))
4+
(type $2 (func (param f64 f32 f32 f64 f32 i32 i32 f64) (result i32)))
5+
(global $global$0 (mut i32) (i32.const 10))
6+
(func $0 (; 0 ;) (result i32)
7+
(local $0 i32)
8+
(local $1 i32)
9+
(drop
10+
(if (result f32)
11+
(local.tee $0
12+
(i32.const 33554432)
13+
)
14+
(loop $label$2 (result f32)
15+
(if
16+
(global.get $global$0)
17+
(return
18+
(local.get $0)
19+
)
20+
)
21+
(local.set $0
22+
(local.get $1)
23+
)
24+
(local.set $1
25+
(i32.const 0)
26+
)
27+
(br_if $label$2
28+
(local.get $0)
29+
)
30+
(f32.const 1)
31+
)
32+
(call $1)
33+
)
34+
)
35+
(i32.const -11)
36+
)
37+
(func $1 (; 1 ;) (result f32)
38+
(f32.const 0)
39+
)
40+
(func $2 (; 2 ;) (type $2) (param $0 f64) (param $1 f32) (param $2 f32) (param $3 f64) (param $4 f32) (param $5 i32) (param $6 i32) (param $7 f64) (result i32)
41+
(call $0)
42+
)
43+
)

test/passes/dae-optimizing.wast

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
(module
2+
(type $0 (func (param f32) (result f32)))
3+
(type $1 (func (param f64 f32 f32 f64 f32 i64 f64) (result i32)))
4+
(type $2 (func (param f64 f32 f32 f64 f32 i32 i32 f64) (result i32)))
5+
(global $global$0 (mut i32) (i32.const 10))
6+
(func $0 (; 0 ;) (type $1) (param $0 f64) (param $1 f32) (param $2 f32) (param $3 f64) (param $4 f32) (param $5 i64) (param $6 f64) (result i32)
7+
(local $7 i32)
8+
(local $8 i32)
9+
(if
10+
(local.tee $7
11+
(i32.const 33554432)
12+
)
13+
(drop
14+
(loop $label$2 (result f32)
15+
(if
16+
(global.get $global$0)
17+
(return
18+
(local.get $7)
19+
)
20+
)
21+
(local.set $8
22+
(block $label$4 (result i32)
23+
(drop
24+
(local.tee $7
25+
(local.get $8)
26+
)
27+
)
28+
(i32.const 0)
29+
)
30+
)
31+
(br_if $label$2
32+
(local.get $7)
33+
)
34+
(f32.const 1)
35+
)
36+
)
37+
(drop
38+
(call $1
39+
(f32.const 1)
40+
)
41+
)
42+
)
43+
(i32.const -11)
44+
)
45+
(func $1 (; 1 ;) (type $0) (param $0 f32) (result f32)
46+
(f32.const 0)
47+
)
48+
(func $2 (; 2 ;) (type $2) (param $0 f64) (param $1 f32) (param $2 f32) (param $3 f64) (param $4 f32) (param $5 i32) (param $6 i32) (param $7 f64) (result i32)
49+
(call $0
50+
(f64.const 1)
51+
(f32.const 1)
52+
(f32.const 1)
53+
(f64.const 1)
54+
(f32.const 1)
55+
(i64.const 1)
56+
(f64.const 1)
57+
)
58+
)
59+
)
60+

0 commit comments

Comments
 (0)