Skip to content

minor improvements for pass pipeline #1424

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Aug 5, 2020
19 changes: 11 additions & 8 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1506,7 +1506,14 @@ export class Module {
// --- PassRunner::addDefaultFunctionOptimizationPasses ---

if (optimizeLevel >= 3 || shrinkLevel >= 1) {
passes.push("simplify-locals-notee-nostructure");
passes.push("rse");
passes.push("vacuum");
passes.push("ssa-nomerge");
passes.push("simplify-globals-optimizing");
passes.push("remove-unused-brs");
passes.push("remove-unused-names");
passes.push("merge-blocks");
}
if (optimizeLevel >= 3) {
passes.push("flatten");
Expand All @@ -1518,10 +1525,6 @@ export class Module {
passes.push("local-cse");
passes.push("reorder-locals");
}
if (optimizeLevel >= 2 || shrinkLevel >= 1) {
passes.push("rse");
passes.push("vacuum");
}
// FIXME: see issue #1288
// if (usesARC) {
// if (optimizeLevel < 3) {
Expand All @@ -1537,16 +1540,16 @@ export class Module {
passes.push("remove-unused-brs");
passes.push("remove-unused-names");
passes.push("inlining-optimizing");
if (optimizeLevel >= 2 || shrinkLevel >= 1) {
passes.push("pick-load-signs");
passes.push("simplify-globals-optimizing");
}
if (optimizeLevel >= 3 || shrinkLevel >= 2) {
passes.push("precompute-propagate");
} else {
passes.push("precompute");
}
passes.push("vacuum");
if (optimizeLevel >= 2 || shrinkLevel >= 1) {
passes.push("pick-load-signs");
passes.push("simplify-globals-optimizing");
}
if (optimizeLevel >= 3 && shrinkLevel <= 1) {
passes.push("licm");
}
Expand Down
16 changes: 8 additions & 8 deletions tests/compiler/binary.optimized.wat
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@
local.get $0
i32.reinterpret_f32
local.tee $1
i32.const -2147483648
i32.and
local.set $4
local.get $1
i32.const 23
i32.shr_u
i32.const 255
Expand All @@ -63,10 +67,6 @@
f32.div
return
end
local.get $1
i32.const -2147483648
i32.and
local.set $4
block $folding-inner0
local.get $1
i32.const 1
Expand Down Expand Up @@ -191,6 +191,10 @@
local.get $0
i64.reinterpret_f64
local.tee $1
i64.const 63
i64.shr_u
local.set $4
local.get $1
i64.const 52
i64.shr_u
i64.const 2047
Expand All @@ -204,10 +208,6 @@
f64.div
return
end
local.get $1
i64.const 63
i64.shr_u
local.set $4
block $folding-inner0
local.get $1
i64.const 1
Expand Down
11 changes: 0 additions & 11 deletions tests/compiler/comma.optimized.wat
Original file line number Diff line number Diff line change
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
Loading