Skip to content

Commit 4295c2b

Browse files
committed
add extra simplify-global-optimizig
1 parent 3406f9f commit 4295c2b

File tree

4 files changed

+15
-34
lines changed

4 files changed

+15
-34
lines changed

cli/asc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,7 @@ exports.main = function main(argv, options, callback) {
775775
// }
776776
if (optimizeLevel >= 3) {
777777
add("optimize-instructions");
778+
add("simplify-globals-optimizing");
778779
}
779780
if (optimizeLevel >= 2 || shrinkLevel >= 1) {
780781
add("rse");

tests/compiler/comma.optimized.wat

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -76,21 +76,10 @@
7676
global.set $comma/b
7777
i32.const 2
7878
global.set $comma/a
79-
global.get $comma/a
79+
i32.const 2
8080
global.set $comma/b
81-
global.get $comma/b
82-
global.set $comma/a
83-
global.get $comma/a
8481
i32.const 2
85-
i32.ne
86-
if
87-
i32.const 0
88-
i32.const 1040
89-
i32.const 18
90-
i32.const 1
91-
call $~lib/builtins/abort
92-
unreachable
93-
end
82+
global.set $comma/a
9483
global.get $comma/b
9584
i32.const 2
9685
i32.ne

tests/compiler/resolve-elementaccess.optimized.wat

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2001,13 +2001,14 @@
20012001
i32.const 7
20022002
call $~lib/rt/stub/__alloc
20032003
local.tee $0
2004-
if (result i32)
2005-
local.get $0
2006-
else
2004+
i32.eqz
2005+
if
20072006
i32.const 12
20082007
i32.const 8
20092008
call $~lib/rt/stub/__alloc
2009+
local.set $0
20102010
end
2011+
local.get $0
20112012
i32.const 0
20122013
call $~lib/arraybuffer/ArrayBufferView#constructor
20132014
global.set $resolve-elementaccess/buf

tests/compiler/unary.optimized.wat

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@
4444
global.set $unary/i
4545
i32.const 0
4646
global.set $unary/i
47-
global.get $unary/i
48-
i32.const 1
49-
i32.sub
47+
i32.const -1
5048
global.set $unary/i
5149
global.get $unary/i
5250
local.tee $0
@@ -94,9 +92,7 @@
9492
global.set $unary/I
9593
i64.const 0
9694
global.set $unary/I
97-
global.get $unary/I
98-
i64.const 1
99-
i64.sub
95+
i64.const -1
10096
global.set $unary/I
10197
global.get $unary/I
10298
local.tee $1
@@ -144,14 +140,11 @@
144140
global.set $unary/f
145141
f32.const 1.25
146142
global.set $unary/f
147-
f32.const 1.25
148-
local.tee $2
149-
f32.const 1
150-
f32.add
143+
f32.const 2.25
151144
global.set $unary/f
152-
local.get $2
145+
f32.const 1.25
153146
global.set $unary/f
154-
global.get $unary/f
147+
f32.const 1.25
155148
local.tee $2
156149
f32.const 1
157150
f32.sub
@@ -190,14 +183,11 @@
190183
global.set $unary/F
191184
f64.const 1.25
192185
global.set $unary/F
193-
f64.const 1.25
194-
local.tee $3
195-
f64.const 1
196-
f64.add
186+
f64.const 2.25
197187
global.set $unary/F
198-
local.get $3
188+
f64.const 1.25
199189
global.set $unary/F
200-
global.get $unary/F
190+
f64.const 1.25
201191
local.tee $3
202192
f64.const 1
203193
f64.sub

0 commit comments

Comments
 (0)