Skip to content

Reduce One Caller Inline Max Size to 160 for high optimization levels #1923

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

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2233,7 +2233,7 @@ export class Module {
if (optimizeLevel >= 2 && shrinkLevel == 0) {
this.setAlwaysInlineMaxSize(12);
this.setFlexibleInlineMaxSize(70);
this.setOneCallerInlineMaxSize(200);
this.setOneCallerInlineMaxSize(160);
this.setAllowInliningFunctionsWithLoops(optimizeLevel >= 3);
} else {
this.setAlwaysInlineMaxSize(
Expand Down
43 changes: 20 additions & 23 deletions tests/compiler/NonNullable.optimized.wat
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
i32.load offset=16
i32.const 1
i32.shr_u
local.tee $4
local.tee $2
local.get $1
i32.const 20
i32.sub
Expand All @@ -59,39 +59,36 @@
end
block $__inlined_func$~lib/util/string/compareImpl (result i32)
local.get $0
local.set $2
local.get $1
local.set $3
local.get $2
local.tee $3
i32.const 7
i32.and
local.get $3
local.get $1
i32.const 7
i32.and
i32.or
i32.const 1
local.get $4
local.get $2
local.tee $0
i32.const 4
i32.ge_u
select
i32.eqz
if
loop $do-continue|0
local.get $2
i64.load
local.get $3
i64.load
local.get $1
i64.load
i64.eq
if
local.get $2
i32.const 8
i32.add
local.set $2
local.get $3
i32.const 8
i32.add
local.set $3
local.get $1
i32.const 8
i32.add
local.set $1
local.get $0
i32.const 4
i32.sub
Expand All @@ -104,33 +101,33 @@
end
loop $while-continue|1
local.get $0
local.tee $1
local.tee $2
i32.const 1
i32.sub
local.set $0
local.get $1
local.get $2
if
local.get $2
i32.load16_u
local.tee $1
local.get $3
i32.load16_u
local.tee $2
local.get $1
i32.load16_u
local.tee $4
i32.ne
if
local.get $1
local.get $2
local.get $4
i32.sub
br $__inlined_func$~lib/util/string/compareImpl
end
local.get $2
i32.const 2
i32.add
local.set $2
local.get $3
i32.const 2
i32.add
local.set $3
local.get $1
i32.const 2
i32.add
local.set $1
br $while-continue|1
end
end
Expand Down
5 changes: 4 additions & 1 deletion tests/compiler/binary.optimized.wat
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
(data (i32.const 7430) "\f0?t\85\15\d3\b0\d9\ef?\0f\89\f9lX\b5\ef?Q[\12\d0\01\93\ef?{Q}<\b8r\ef?\aa\b9h1\87T\ef?8bunz8\ef?\e1\de\1f\f5\9d\1e\ef?\15\b71\n\fe\06\ef?\cb\a9:7\a7\f1\ee?\"4\12L\a6\de\ee?-\89a`\08\ce\ee?\'*6\d5\da\bf\ee?\82O\9dV+\b4\ee?)TH\dd\07\ab\ee?\85U:\b0~\a4\ee?\cd;\7ff\9e\a0\ee?t_\ec\e8u\9f\ee?\87\01\ebs\14\a1\ee?\13\ceL\99\89\a5\ee?\db\a0*B\e5\ac\ee?\e5\c5\cd\b07\b7\ee?\90\f0\a3\82\91\c4\ee?]%>\b2\03\d5\ee?\ad\d3Z\99\9f\e8\ee?G^\fb\f2v\ff\ee?\9cR\85\dd\9b\19\ef?i\90\ef\dc 7\ef?\87\a4\fb\dc\18X\ef?_\9b{3\97|\ef?\da\90\a4\a2\af\a4\ef?@En[v\d0\ef?")
(export "memory" (memory $0))
(start $~start)
(func $~start
(func $start:binary
(local $0 f32)
(local $1 f64)
block $__inlined_func$~lib/math/ipow32
Expand Down Expand Up @@ -317,4 +317,7 @@
f64.copysign
global.set $binary/F
)
(func $~start
call $start:binary
)
)
43 changes: 20 additions & 23 deletions tests/compiler/builtins.optimized.wat
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
i32.load offset=16
i32.const 1
i32.shr_u
local.tee $4
local.tee $2
local.get $1
i32.const 20
i32.sub
Expand All @@ -115,39 +115,36 @@
end
block $__inlined_func$~lib/util/string/compareImpl (result i32)
local.get $0
local.set $2
local.get $1
local.set $3
local.get $2
local.tee $3
i32.const 7
i32.and
local.get $3
local.get $1
i32.const 7
i32.and
i32.or
i32.const 1
local.get $4
local.get $2
local.tee $0
i32.const 4
i32.ge_u
select
i32.eqz
if
loop $do-continue|0
local.get $2
i64.load
local.get $3
i64.load
local.get $1
i64.load
i64.eq
if
local.get $2
i32.const 8
i32.add
local.set $2
local.get $3
i32.const 8
i32.add
local.set $3
local.get $1
i32.const 8
i32.add
local.set $1
local.get $0
i32.const 4
i32.sub
Expand All @@ -160,33 +157,33 @@
end
loop $while-continue|1
local.get $0
local.tee $1
local.tee $2
i32.const 1
i32.sub
local.set $0
local.get $1
local.get $2
if
local.get $2
i32.load16_u
local.tee $1
local.get $3
i32.load16_u
local.tee $2
local.get $1
i32.load16_u
local.tee $4
i32.ne
if
local.get $1
local.get $2
local.get $4
i32.sub
br $__inlined_func$~lib/util/string/compareImpl
end
local.get $2
i32.const 2
i32.add
local.set $2
local.get $3
i32.const 2
i32.add
local.set $3
local.get $1
i32.const 2
i32.add
local.set $1
br $while-continue|1
end
end
Expand Down
Loading