Skip to content

Commit

Permalink
early glob optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxGraey committed Aug 3, 2020
1 parent 112160a commit 6cba9a2
Show file tree
Hide file tree
Showing 37 changed files with 1,324 additions and 1,311 deletions.
1 change: 1 addition & 0 deletions src/module.ts
Expand Up @@ -1510,6 +1510,7 @@ export class Module {
passes.push("rse");
passes.push("vacuum");
passes.push("ssa-nomerge");
passes.push("simplify-globals-optimizing");
}
if (optimizeLevel >= 3) {
passes.push("flatten");
Expand Down
11 changes: 0 additions & 11 deletions tests/compiler/comma.optimized.wat
Expand Up @@ -80,17 +80,6 @@
global.set $comma/b
i32.const 2
global.set $comma/a
global.get $comma/b
i32.const 2
i32.ne
if
i32.const 0
i32.const 1040
i32.const 19
i32.const 1
call $~lib/builtins/abort
unreachable
end
loop $for-loop|0
local.get $0
global.get $comma/a
Expand Down
5 changes: 3 additions & 2 deletions tests/compiler/do.optimized.wat
Expand Up @@ -688,7 +688,8 @@
unreachable
end
i32.const 1216
local.tee $1
local.set $1
i32.const 1216
i32.const 0
i32.store
i32.const 2784
Expand All @@ -713,10 +714,10 @@
i32.const 16
i32.lt_u
if
local.get $2
local.get $0
i32.const 4
i32.shl
local.get $2
i32.add
i32.const 2
i32.shl
Expand Down
16 changes: 7 additions & 9 deletions tests/compiler/extends-baseaggregate.optimized.wat
Expand Up @@ -613,7 +613,8 @@
unreachable
end
i32.const 1568
local.tee $1
local.set $1
i32.const 1568
i32.const 0
i32.store
i32.const 3136
Expand All @@ -638,10 +639,10 @@
i32.const 16
i32.lt_u
if
local.get $2
local.get $0
i32.const 4
i32.shl
local.get $2
i32.add
i32.const 2
i32.shl
Expand Down Expand Up @@ -1379,10 +1380,10 @@
local.get $6
call $~lib/rt/tlsf/removeBlock
local.get $1
local.get $4
local.get $5
i32.const 3
i32.and
local.get $4
i32.or
i32.store
local.get $1
Expand Down Expand Up @@ -2106,14 +2107,11 @@
block $case3|0
block $case2|0
block $case1|0
local.get $1
i32.const 1
i32.ne
if
block $case0|0
local.get $1
i32.const 2
i32.const 1
i32.sub
br_table $case1|0 $case2|0 $case3|0 $case4|0 $case5|0
br_table $case0|0 $case1|0 $case2|0 $case3|0 $case4|0 $case5|0
end
local.get $0
call $~lib/rt/pure/decrement
Expand Down
5 changes: 3 additions & 2 deletions tests/compiler/for.optimized.wat
Expand Up @@ -685,7 +685,8 @@
unreachable
end
i32.const 1216
local.tee $1
local.set $1
i32.const 1216
i32.const 0
i32.store
i32.const 2784
Expand All @@ -710,10 +711,10 @@
i32.const 16
i32.lt_u
if
local.get $2
local.get $0
i32.const 4
i32.shl
local.get $2
i32.add
i32.const 2
i32.shl
Expand Down
5 changes: 3 additions & 2 deletions tests/compiler/implicit-getter-setter.optimized.wat
Expand Up @@ -620,7 +620,8 @@
unreachable
end
i32.const 1232
local.tee $1
local.set $1
i32.const 1232
i32.const 0
i32.store
i32.const 2800
Expand All @@ -645,10 +646,10 @@
i32.const 16
i32.lt_u
if
local.get $2
local.get $0
i32.const 4
i32.shl
local.get $2
i32.add
i32.const 2
i32.shl
Expand Down
5 changes: 3 additions & 2 deletions tests/compiler/issues/1095.optimized.wat
Expand Up @@ -605,7 +605,8 @@
unreachable
end
i32.const 1312
local.tee $1
local.set $1
i32.const 1312
i32.const 0
i32.store
i32.const 2880
Expand All @@ -630,10 +631,10 @@
i32.const 16
i32.lt_u
if
local.get $2
local.get $0
i32.const 4
i32.shl
local.get $2
i32.add
i32.const 2
i32.shl
Expand Down
5 changes: 3 additions & 2 deletions tests/compiler/issues/1225.optimized.wat
Expand Up @@ -606,7 +606,8 @@
unreachable
end
i32.const 1232
local.tee $1
local.set $1
i32.const 1232
i32.const 0
i32.store
i32.const 2800
Expand All @@ -631,10 +632,10 @@
i32.const 16
i32.lt_u
if
local.get $2
local.get $0
i32.const 4
i32.shl
local.get $2
i32.add
i32.const 2
i32.shl
Expand Down
5 changes: 3 additions & 2 deletions tests/compiler/logical.optimized.wat
Expand Up @@ -603,7 +603,8 @@
unreachable
end
i32.const 1232
local.tee $1
local.set $1
i32.const 1232
i32.const 0
i32.store
i32.const 2800
Expand All @@ -628,10 +629,10 @@
i32.const 16
i32.lt_u
if
local.get $2
local.get $0
i32.const 4
i32.shl
local.get $2
i32.add
i32.const 2
i32.shl
Expand Down
5 changes: 3 additions & 2 deletions tests/compiler/managed-cast.optimized.wat
Expand Up @@ -608,7 +608,8 @@
unreachable
end
i32.const 1392
local.tee $1
local.set $1
i32.const 1392
i32.const 0
i32.store
i32.const 2960
Expand All @@ -633,10 +634,10 @@
i32.const 16
i32.lt_u
if
local.get $2
local.get $0
i32.const 4
i32.shl
local.get $2
i32.add
i32.const 2
i32.shl
Expand Down
5 changes: 3 additions & 2 deletions tests/compiler/object-literal.optimized.wat
Expand Up @@ -612,7 +612,8 @@
unreachable
end
i32.const 1440
local.tee $1
local.set $1
i32.const 1440
i32.const 0
i32.store
i32.const 3008
Expand All @@ -637,10 +638,10 @@
i32.const 16
i32.lt_u
if
local.get $2
local.get $0
i32.const 4
i32.shl
local.get $2
i32.add
i32.const 2
i32.shl
Expand Down
5 changes: 3 additions & 2 deletions tests/compiler/rc/local-init.optimized.wat
Expand Up @@ -603,7 +603,8 @@
unreachable
end
i32.const 1200
local.tee $1
local.set $1
i32.const 1200
i32.const 0
i32.store
i32.const 2768
Expand All @@ -628,10 +629,10 @@
i32.const 16
i32.lt_u
if
local.get $2
local.get $0
i32.const 4
i32.shl
local.get $2
i32.add
i32.const 2
i32.shl
Expand Down
5 changes: 3 additions & 2 deletions tests/compiler/rc/logical-and-mismatch.optimized.wat
Expand Up @@ -603,7 +603,8 @@
unreachable
end
i32.const 1184
local.tee $1
local.set $1
i32.const 1184
i32.const 0
i32.store
i32.const 2752
Expand All @@ -628,10 +629,10 @@
i32.const 16
i32.lt_u
if
local.get $2
local.get $0
i32.const 4
i32.shl
local.get $2
i32.add
i32.const 2
i32.shl
Expand Down
5 changes: 3 additions & 2 deletions tests/compiler/rc/logical-or-mismatch.optimized.wat
Expand Up @@ -603,7 +603,8 @@
unreachable
end
i32.const 1184
local.tee $1
local.set $1
i32.const 1184
i32.const 0
i32.store
i32.const 2752
Expand All @@ -628,10 +629,10 @@
i32.const 16
i32.lt_u
if
local.get $2
local.get $0
i32.const 4
i32.shl
local.get $2
i32.add
i32.const 2
i32.shl
Expand Down
5 changes: 3 additions & 2 deletions tests/compiler/rc/optimize.optimized.wat
Expand Up @@ -693,7 +693,8 @@
unreachable
end
i32.const 1216
local.tee $1
local.set $1
i32.const 1216
i32.const 0
i32.store
i32.const 2784
Expand All @@ -718,10 +719,10 @@
i32.const 16
i32.lt_u
if
local.get $2
local.get $0
i32.const 4
i32.shl
local.get $2
i32.add
i32.const 2
i32.shl
Expand Down
5 changes: 3 additions & 2 deletions tests/compiler/rc/rereturn.optimized.wat
Expand Up @@ -606,7 +606,8 @@
unreachable
end
i32.const 1232
local.tee $1
local.set $1
i32.const 1232
i32.const 0
i32.store
i32.const 2800
Expand All @@ -631,10 +632,10 @@
i32.const 16
i32.lt_u
if
local.get $2
local.get $0
i32.const 4
i32.shl
local.get $2
i32.add
i32.const 2
i32.shl
Expand Down
5 changes: 3 additions & 2 deletions tests/compiler/rc/ternary-mismatch.optimized.wat
Expand Up @@ -605,7 +605,8 @@
unreachable
end
i32.const 1184
local.tee $1
local.set $1
i32.const 1184
i32.const 0
i32.store
i32.const 2752
Expand All @@ -630,10 +631,10 @@
i32.const 16
i32.lt_u
if
local.get $2
local.get $0
i32.const 4
i32.shl
local.get $2
i32.add
i32.const 2
i32.shl
Expand Down

0 comments on commit 6cba9a2

Please sign in to comment.