Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1622,6 +1622,7 @@ export class Module {
if (optimizeLevel >= 3) {
// very expensive, so O3 only
passes.push("simplify-globals");
passes.push("simplify-locals");
passes.push("vacuum");
// replace indirect with direct calls again and inline
passes.push("inlining-optimizing");
Expand Down
12 changes: 6 additions & 6 deletions tests/compiler/binary.optimized.wat
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,17 @@
local.get $1
i32.const 8388608
i32.ge_u
if
if (result i32)
local.get $1
i32.const 8388608
i32.eq
br_if $folding-inner0
local.get $1
i32.const 8388608
i32.sub
local.set $1
else
local.get $1
end
local.get $1
i32.const 1
i32.shl
local.set $1
Expand Down Expand Up @@ -261,17 +261,17 @@
local.get $1
i64.const 4503599627370496
i64.ge_u
if
if (result i64)
local.get $1
i64.const 4503599627370496
i64.eq
br_if $folding-inner0
local.get $1
i64.const 4503599627370496
i64.sub
local.set $1
else
local.get $1
end
local.get $1
i64.const 1
i64.shl
local.set $1
Expand Down
5 changes: 2 additions & 3 deletions tests/compiler/class-overloading.optimized.wat
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,11 @@
local.set $0
end
local.get $0
i32.eqz
if (result i32)
local.get $0
else
i32.const 3
call $~lib/rt/stub/__alloc
else
local.get $0
end
)
(func $~lib/string/String#get:length (param $0 i32) (result i32)
Expand Down
88 changes: 45 additions & 43 deletions tests/compiler/do.optimized.wat
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@
end
local.get $1
i32.load
local.tee $3
local.tee $4
i32.const 1
i32.and
i32.eqz
Expand All @@ -307,35 +307,35 @@
i32.const -4
i32.and
i32.add
local.tee $4
i32.load
local.tee $5
i32.load
local.tee $2
i32.const 1
i32.and
if
local.get $3
local.get $4
i32.const -4
i32.and
i32.const 16
i32.add
local.get $5
local.get $2
i32.const -4
i32.and
i32.add
local.tee $2
local.tee $3
i32.const 1073741808
i32.lt_u
if
local.get $0
local.get $4
local.get $5
call $~lib/rt/tlsf/removeBlock
local.get $1
local.get $2
local.get $3
local.get $4
i32.const 3
i32.and
i32.or
local.tee $3
local.tee $4
i32.store
local.get $1
i32.const 16
Expand All @@ -345,20 +345,20 @@
i32.const -4
i32.and
i32.add
local.tee $4
local.tee $5
i32.load
local.set $5
local.set $2
end
end
local.get $3
local.get $4
i32.const 2
i32.and
if
local.get $1
i32.const 4
i32.sub
i32.load
local.tee $2
local.tee $3
i32.load
local.tee $7
i32.const 1
Expand All @@ -377,42 +377,44 @@
i32.and
i32.const 16
i32.add
local.get $3
local.get $4
i32.const -4
i32.and
i32.add
local.tee $8
i32.const 1073741808
i32.lt_u
if
if (result i32)
local.get $0
local.get $2
local.get $3
call $~lib/rt/tlsf/removeBlock
local.get $2
local.get $3
local.get $8
local.get $7
i32.const 3
i32.and
i32.or
local.tee $3
local.tee $4
i32.store
local.get $2
local.set $1
local.get $3
else
local.get $1
end
local.set $1
end
local.get $4
local.get $5
local.get $2
i32.const 2
i32.or
i32.store
local.get $3
local.get $4
i32.const -4
i32.and
local.tee $2
local.tee $3
i32.const 16
i32.ge_u
if (result i32)
local.get $2
local.get $3
i32.const 1073741808
i32.lt_u
else
Expand All @@ -427,12 +429,12 @@
call $~lib/builtins/abort
unreachable
end
local.get $2
local.get $3
local.get $1
i32.const 16
i32.add
i32.add
local.get $4
local.get $5
i32.ne
if
i32.const 0
Expand All @@ -442,38 +444,38 @@
call $~lib/builtins/abort
unreachable
end
local.get $4
local.get $5
i32.const 4
i32.sub
local.get $1
i32.store
local.get $2
local.get $3
i32.const 256
i32.lt_u
if
local.get $2
local.get $3
i32.const 4
i32.shr_u
local.set $2
local.set $3
else
local.get $2
local.get $3
i32.const 31
local.get $2
local.get $3
i32.clz
i32.sub
local.tee $3
local.tee $4
i32.const 4
i32.sub
i32.shr_u
i32.const 16
i32.xor
local.set $2
local.get $3
local.set $3
local.get $4
i32.const 7
i32.sub
local.set $6
end
local.get $2
local.get $3
i32.const 16
i32.lt_u
i32.const 0
Expand All @@ -491,7 +493,7 @@
unreachable
end
local.get $0
local.get $2
local.get $3
local.get $6
i32.const 4
i32.shl
Expand All @@ -500,21 +502,21 @@
i32.shl
i32.add
i32.load offset=96
local.set $3
local.set $4
local.get $1
i32.const 0
i32.store offset=16
local.get $1
local.get $3
local.get $4
i32.store offset=20
local.get $3
local.get $4
if
local.get $3
local.get $4
local.get $1
i32.store offset=16
end
local.get $0
local.get $2
local.get $3
local.get $6
i32.const 4
i32.shl
Expand All @@ -541,7 +543,7 @@
local.get $0
i32.load offset=4
i32.const 1
local.get $2
local.get $3
i32.shl
i32.or
i32.store offset=4
Expand Down
Loading