-
Notifications
You must be signed in to change notification settings - Fork 869
ConstraintAnalysis: Fix Pops and non-nullable LocalSets #8895
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
kripken
wants to merge
10
commits into
WebAssembly:main
Choose a base branch
from
kripken:constraint.eh
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.
+103
−4
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9c8f060
ConstraintAnalysis: Do not apply constraints in unreachable code
kripken d9456a3
ConstraintAnalysis: Fix assertion on trivial info
kripken 2a4c8dc
start
kripken da78ba9
work
kripken 79a1f3c
finish
kripken 25abfe7
fix
kripken 8632403
Merge branch 'constraint.fix' into constraint.eh
kripken 2281c86
work
kripken 88d63b8
format
kripken 9bb419f
Merge remote-tracking branch 'origin/main' into constraint.eh
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| ;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited. | ||
|
|
||
| ;; RUN: wasm-opt %s --constraint-analysis -all -S -o - | filecheck %s | ||
|
|
||
| (module | ||
| ;; CHECK: (tag $tag (type $0) (param i32)) | ||
| (tag $tag (param i32)) | ||
|
|
||
| ;; CHECK: (func $pop-unreachable (type $1) | ||
| ;; CHECK-NEXT: (local $x i32) | ||
| ;; CHECK-NEXT: (try | ||
| ;; CHECK-NEXT: (do | ||
| ;; CHECK-NEXT: ) | ||
| ;; CHECK-NEXT: (catch $tag | ||
| ;; CHECK-NEXT: (local.set $x | ||
| ;; CHECK-NEXT: (pop i32) | ||
| ;; CHECK-NEXT: ) | ||
| ;; CHECK-NEXT: (unreachable) | ||
| ;; CHECK-NEXT: ) | ||
| ;; CHECK-NEXT: ) | ||
| ;; CHECK-NEXT: ) | ||
| (func $pop-unreachable | ||
| (local $x i32) | ||
| (try | ||
| (do | ||
| ) | ||
| (catch $tag | ||
| ;; This code is unreachable: no throw exists that can reach it. However, it | ||
| ;; is invalid to remove a pop, as that would not validate, so we keep it. We | ||
| ;; also keep the set, as it may be needed for non-nullable local validation. | ||
| (local.set $x | ||
| (pop i32) | ||
| ) | ||
| ) | ||
| ) | ||
| ) | ||
|
|
||
| ;; CHECK: (func $pop-unreachable-result (type $2) (result i32) | ||
| ;; CHECK-NEXT: (local $x i32) | ||
| ;; CHECK-NEXT: (local $1 i32) | ||
| ;; CHECK-NEXT: (try (result i32) | ||
| ;; CHECK-NEXT: (do | ||
| ;; CHECK-NEXT: (i32.const 10) | ||
| ;; CHECK-NEXT: ) | ||
| ;; CHECK-NEXT: (catch $tag | ||
| ;; CHECK-NEXT: (local.set $1 | ||
| ;; CHECK-NEXT: (pop i32) | ||
| ;; CHECK-NEXT: ) | ||
| ;; CHECK-NEXT: (block (result i32) | ||
| ;; CHECK-NEXT: (block | ||
| ;; CHECK-NEXT: (local.set $x | ||
| ;; CHECK-NEXT: (local.get $1) | ||
| ;; CHECK-NEXT: ) | ||
| ;; CHECK-NEXT: (unreachable) | ||
| ;; CHECK-NEXT: ) | ||
| ;; CHECK-NEXT: (i32.const 20) | ||
| ;; CHECK-NEXT: ) | ||
| ;; CHECK-NEXT: ) | ||
| ;; CHECK-NEXT: ) | ||
| ;; CHECK-NEXT: ) | ||
| (func $pop-unreachable-result (result i32) | ||
| (local $x i32) | ||
| ;; As above, but now with a result. This adds a block we need to fix up EH | ||
| ;; for. | ||
| (try (result i32) | ||
| (do | ||
| (i32.const 10) | ||
| ) | ||
| (catch $tag | ||
| (local.set $x | ||
| (pop i32) | ||
| ) | ||
| (i32.const 20) | ||
| ) | ||
| ) | ||
| ) | ||
| ) | ||
|
|
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
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 see the unreachable that was appended, but where are the dropped children? And what's the connection to non-nullable local validation here? The i32 local is not non-nullable.