-
Notifications
You must be signed in to change notification settings - Fork 786
Always inline trivial calls that always shrink #7669
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
Open
osa1
wants to merge
12
commits into
WebAssembly:main
Choose a base branch
from
osa1:inlining_tweaks
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+451
−30
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
18f188d
Always inline trivial calls that always shrinks
osa1 78960aa
Fix shrink flag
osa1 6486c91
Rename isTrivialCall -> trivialCall
osa1 aff857d
Bring back calls check
osa1 48b6914
Don't allow skipping args
osa1 c607e1e
ADd test
osa1 3d86e66
Refactor
osa1 703451b
More tests
osa1 64d9776
Merge remote-tracking branch 'origin/main' into inlining_tweaks
osa1 ae77f8b
Rewording
osa1 c64e72b
Add test for const args
osa1 85c29e5
Update comments
osa1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. | ||
|
||
;; With `-O3`, we always inline calls to functions that just call other | ||
;; functions with "trivial" arguments. | ||
;; | ||
;; A trivial argument for now is just an instruction with size 1. E.g. | ||
;; `local.get`, constants. | ||
|
||
;; RUN: foreach %s %t wasm-opt -all -O3 -S -o - | filecheck %s --check-prefix=O3 | ||
;; RUN: foreach %s %t wasm-opt -all -O2 -S -o - | filecheck %s --check-prefix=O2 | ||
;; RUN: foreach %s %t wasm-opt -all -Os -S -o - | filecheck %s --check-prefix=Os | ||
|
||
(module | ||
;; O3: (type $0 (func (param i32 i32 i32))) | ||
;; O2: (type $1 (func)) | ||
|
||
;; O2: (type $0 (func (param i32 i32 i32))) | ||
;; Os: (type $1 (func)) | ||
|
||
;; Os: (type $0 (func (param i32 i32 i32))) | ||
(type $0 (func (param i32 i32 i32))) | ||
|
||
;; O3: (type $1 (func)) | ||
(type $1 (func)) | ||
|
||
(type $2 (func)) | ||
|
||
;; O3: (import "env" "foo" (func $imported-foo (type $0) (param i32 i32 i32))) | ||
;; O2: (import "env" "foo" (func $imported-foo (type $0) (param i32 i32 i32))) | ||
;; Os: (import "env" "foo" (func $imported-foo (type $0) (param i32 i32 i32))) | ||
(import "env" "foo" (func $imported-foo (type $0) (param i32 i32 i32))) | ||
|
||
;; O3: (export "main" (func $main)) | ||
;; O2: (export "main" (func $main)) | ||
;; Os: (export "main" (func $main)) | ||
(export "main" (func $main)) | ||
|
||
;; O2: (func $call-foo (type $1) | ||
;; O2-NEXT: (call $imported-foo | ||
;; O2-NEXT: (i32.const 1) | ||
;; O2-NEXT: (i32.const 2) | ||
;; O2-NEXT: (i32.const 3) | ||
;; O2-NEXT: ) | ||
;; O2-NEXT: ) | ||
;; Os: (func $call-foo (type $1) | ||
;; Os-NEXT: (call $imported-foo | ||
;; Os-NEXT: (i32.const 1) | ||
;; Os-NEXT: (i32.const 2) | ||
;; Os-NEXT: (i32.const 3) | ||
;; Os-NEXT: ) | ||
;; Os-NEXT: ) | ||
(func $call-foo (type $1) | ||
(call $imported-foo | ||
(i32.const 1) | ||
(i32.const 2) | ||
(i32.const 3))) | ||
|
||
;; O3: (func $main (type $1) | ||
;; O3-NEXT: (call $imported-foo | ||
;; O3-NEXT: (i32.const 1) | ||
;; O3-NEXT: (i32.const 2) | ||
;; O3-NEXT: (i32.const 3) | ||
;; O3-NEXT: ) | ||
;; O3-NEXT: (call $imported-foo | ||
;; O3-NEXT: (i32.const 1) | ||
;; O3-NEXT: (i32.const 2) | ||
;; O3-NEXT: (i32.const 3) | ||
;; O3-NEXT: ) | ||
;; O3-NEXT: (call $imported-foo | ||
;; O3-NEXT: (i32.const 1) | ||
;; O3-NEXT: (i32.const 2) | ||
;; O3-NEXT: (i32.const 3) | ||
;; O3-NEXT: ) | ||
;; O3-NEXT: ) | ||
;; O2: (func $main (type $1) | ||
;; O2-NEXT: (call $call-foo) | ||
;; O2-NEXT: (call $call-foo) | ||
;; O2-NEXT: (call $call-foo) | ||
;; O2-NEXT: ) | ||
;; Os: (func $main (type $1) | ||
;; Os-NEXT: (call $call-foo) | ||
;; Os-NEXT: (call $call-foo) | ||
;; Os-NEXT: (call $call-foo) | ||
;; Os-NEXT: ) | ||
(func $main (type $2) | ||
(call $call-foo) | ||
(call $call-foo) | ||
(call $call-foo))) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reworded the old comment block here but it just repeats the single line of code below, so I think we can also just drop this comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think your new comment is useful. Let's keep it.