-
Notifications
You must be signed in to change notification settings - Fork 814
DeadArgumentElimination: Refine result types of exported functions #7935
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
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
4e8aada
go
kripken a89e954
more
kripken 61f6636
more
kripken 07978b9
format
kripken 6ff0a6d
fix
kripken ef0a913
fix
kripken 73c7cb9
fix
kripken 8f24b40
update.existing.test
kripken 73ea915
hmm
kripken a633783
work
kripken 58ec930
format
kripken 768969c
add a test
kripken 5e3c946
clean
kripken 40fde5b
Update src/passes/DeadArgumentElimination.cpp
kripken c839fb5
Update src/passes/DeadArgumentElimination.cpp
kripken 6220c7b
Update test/lit/passes/dae-gc.wast
kripken eb1a704
add --all-items
kripken 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
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,38 @@ | ||
;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited. | ||
;; RUN: foreach %s %t wasm-opt -all --disable-custom-descriptors --dae -S -o - | filecheck %s | ||
|
||
;; We cannot refine to an exact type in an export, as CD is disabled. | ||
(module | ||
;; CHECK: (type $A (struct)) | ||
|
||
;; CHECK: (type $func (sub (func (result anyref)))) | ||
(type $func (sub (func (result anyref)))) | ||
|
||
;; CHECK: (type $func2 (sub (func (result anyref i32)))) | ||
(type $func2 (sub (func (result anyref i32)))) | ||
|
||
(type $A (struct)) | ||
|
||
;; CHECK: (func $export (type $3) (result (ref $A)) | ||
;; CHECK-NEXT: (struct.new_default $A) | ||
;; CHECK-NEXT: ) | ||
(func $export (export "export") (type $func) (result anyref) | ||
;; We can refine to (ref $A), but not an exact one. | ||
(struct.new $A) | ||
) | ||
|
||
;; CHECK: (func $export-tuple (type $4) (result (ref $A) i32) | ||
;; CHECK-NEXT: (tuple.make 2 | ||
;; CHECK-NEXT: (struct.new_default $A) | ||
;; CHECK-NEXT: (i32.const 42) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: ) | ||
(func $export-tuple (export "export-tuple") (type $func2) (result anyref i32) | ||
;; Ditto, but the ref is in a tuple. | ||
(tuple.make 2 | ||
(struct.new $A) | ||
(i32.const 42) | ||
) | ||
) | ||
) | ||
|
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.
And also refining the exported function type would allow generalizing the parameter types but not refining them.
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.
Yes (but this pass never generalizes).