Skip to content

[pipeline] Add early inline pass #2117

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 2 commits into from
Nov 4, 2021
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -2298,6 +2298,7 @@ export class Module {
// --- PassRunner::addDefaultFunctionOptimizationPasses ---
if (optimizeLevel >= 2) {
passes.push("once-reduction");
passes.push("inlining");
}
if (optimizeLevel >= 3 || shrinkLevel >= 1) {
passes.push("rse");
Expand Down
98 changes: 50 additions & 48 deletions tests/compiler/NonNullable.optimized.wat
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
(local $2 i32)
(local $3 i32)
(local $4 i32)
(local $5 i32)
local.get $0
local.get $1
i32.eq
Expand Down Expand Up @@ -57,47 +58,47 @@
i32.const 0
return
end
block $__inlined_func$~lib/util/string/compareImpl (result i32)
local.get $0
local.tee $2
i32.const 7
i32.and
local.get $1
i32.const 7
i32.and
i32.or
i32.eqz
local.get $3
local.tee $0
i32.const 4
i32.ge_u
i32.and
if
loop $do-loop|0
local.get $0
local.tee $2
i32.const 7
i32.and
local.get $1
i32.const 7
i32.and
i32.or
i32.eqz
local.get $3
local.tee $0
i32.const 4
i32.ge_u
i32.and
if
loop $do-loop|0
local.get $2
i64.load
local.get $1
i64.load
i64.eq
if
local.get $2
i64.load
i32.const 8
i32.add
local.set $2
local.get $1
i64.load
i64.eq
if
local.get $2
i32.const 8
i32.add
local.set $2
local.get $1
i32.const 8
i32.add
local.set $1
local.get $0
i32.const 4
i32.sub
local.tee $0
i32.const 4
i32.ge_u
br_if $do-loop|0
end
i32.const 8
i32.add
local.set $1
local.get $0
i32.const 4
i32.sub
local.tee $0
i32.const 4
i32.ge_u
br_if $do-loop|0
end
end
end
block $__inlined_func$~lib/util/string/compareImpl
loop $while-continue|1
local.get $0
local.tee $3
Expand All @@ -108,17 +109,16 @@
if
local.get $2
i32.load16_u
local.tee $3
local.tee $5
local.get $1
i32.load16_u
local.tee $4
i32.sub
local.set $3
local.get $4
local.get $5
i32.ne
if
local.get $3
local.get $4
i32.sub
br $__inlined_func$~lib/util/string/compareImpl
end
br_if $__inlined_func$~lib/util/string/compareImpl
local.get $2
i32.const 2
i32.add
Expand All @@ -131,16 +131,18 @@
end
end
i32.const 0
local.set $3
end
local.get $3
i32.eqz
)
(func $~start
(local $0 i32)
global.get $~lib/memory/__stack_pointer
i32.const 12
i32.sub
global.set $~lib/memory/__stack_pointer
block $folding-inner1
global.get $~lib/memory/__stack_pointer
i32.const 12
i32.sub
global.set $~lib/memory/__stack_pointer
block $folding-inner0
global.get $~lib/memory/__stack_pointer
i32.const 1324
Expand Down
Loading