-
Notifications
You must be signed in to change notification settings - Fork 838
[DebugInfo] Add debug info to the values emitted in GlobalStructInference #6709
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,73 @@ | ||||||||||||||
| ;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. | ||||||||||||||
| ;; RUN: env BINARYEN_PRINT_FULL=1 foreach %s %t wasm-opt --gsi -all --closed-world -S -o - | filecheck %s | ||||||||||||||
|
|
||||||||||||||
| ;; Test that debug info is copied to the values we replace a struct.get with. | ||||||||||||||
| ;; We use BINARYEN_PRINT_FULL=1 here because the select that contains the | ||||||||||||||
| ;; values also gets that debug info, and normally we omit debug info of children | ||||||||||||||
| ;; when it matches the parent (so we could not tell without | ||||||||||||||
| ;; BINARYEN_PRINT_FULL=1 whether the children had the debug info or not). | ||||||||||||||
| ;; (Another way to test this would be to run a followup optimization to remove | ||||||||||||||
| ;; the select, but that would be more complex.) | ||||||||||||||
|
|
||||||||||||||
| (module | ||||||||||||||
| ;; CHECK: (type $struct (struct (field i32))) | ||||||||||||||
| (type $struct (struct i32)) | ||||||||||||||
|
|
||||||||||||||
| ;; CHECK: (type $1 (func (param (ref null $struct)))) | ||||||||||||||
|
|
||||||||||||||
| ;; CHECK: (global $global1 (ref $struct) (struct.new $struct | ||||||||||||||
| ;; CHECK-NEXT: (i32.const 42) (; i32 ;) | ||||||||||||||
| ;; CHECK-NEXT: )) | ||||||||||||||
| (global $global1 (ref $struct) (struct.new $struct | ||||||||||||||
| (i32.const 42) | ||||||||||||||
| )) | ||||||||||||||
|
|
||||||||||||||
| ;; CHECK: (global $global2 (ref $struct) (struct.new $struct | ||||||||||||||
| ;; CHECK-NEXT: (i32.const 1337) (; i32 ;) | ||||||||||||||
| ;; CHECK-NEXT: )) | ||||||||||||||
| (global $global2 (ref $struct) (struct.new $struct | ||||||||||||||
| (i32.const 1337) | ||||||||||||||
| )) | ||||||||||||||
|
|
||||||||||||||
| ;; A non-reference global does not confuse us. | ||||||||||||||
| ;; CHECK: (global $global-other i32 (i32.const 123456)) | ||||||||||||||
| (global $global-other i32 (i32.const 123456)) | ||||||||||||||
|
|
||||||||||||||
| ;; CHECK: (func $test (type $1) (param $struct (ref null $struct)) | ||||||||||||||
| ;; CHECK-NEXT: ;;@ drop.c:10:1 | ||||||||||||||
| ;; CHECK-NEXT: (drop | ||||||||||||||
| ;; CHECK-NEXT: ;;@ struct.c:20:2 | ||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did the
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought we were doing that..? Lines 125 to 129 in cdf8139
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, but not recursively, just on the replacement: Line 43 in cdf8139
So the select gets it, but not the select's children. |
||||||||||||||
| ;; CHECK-NEXT: (select | ||||||||||||||
| ;; CHECK-NEXT: ;;@ struct.c:20:2 | ||||||||||||||
| ;; CHECK-NEXT: (i32.const 42) (; i32 ;) | ||||||||||||||
| ;; CHECK-NEXT: ;;@ struct.c:20:2 | ||||||||||||||
| ;; CHECK-NEXT: (i32.const 1337) (; i32 ;) | ||||||||||||||
| ;; CHECK-NEXT: ;;@ | ||||||||||||||
| ;; CHECK-NEXT: (ref.eq | ||||||||||||||
| ;; CHECK-NEXT: ;;@ | ||||||||||||||
| ;; CHECK-NEXT: (ref.as_non_null | ||||||||||||||
| ;; CHECK-NEXT: ;;@ local.c:30:3 | ||||||||||||||
| ;; CHECK-NEXT: (local.get $struct) (; struct null ;) | ||||||||||||||
| ;; CHECK-NEXT: ) (; struct ;) | ||||||||||||||
| ;; CHECK-NEXT: ;;@ | ||||||||||||||
| ;; CHECK-NEXT: (global.get $global1) (; struct ;) | ||||||||||||||
| ;; CHECK-NEXT: ) (; i32 ;) | ||||||||||||||
| ;; CHECK-NEXT: ) (; i32 ;) | ||||||||||||||
| ;; CHECK-NEXT: ) (; none ;) | ||||||||||||||
| ;; CHECK-NEXT: ) | ||||||||||||||
| (func $test (param $struct (ref null $struct)) | ||||||||||||||
| ;; We can infer that this get can reference either $global1 or $global2, | ||||||||||||||
| ;; and nothing else (aside from a null), and can emit a select between | ||||||||||||||
| ;; those values. While doing so we copy the debug info as well to the | ||||||||||||||
| ;; values in the select. | ||||||||||||||
| ;;@ drop.c:10:1 | ||||||||||||||
| (drop | ||||||||||||||
| ;;@ struct.c:20:2 | ||||||||||||||
| (struct.get $struct 0 | ||||||||||||||
| ;;@ local.c:30:3 | ||||||||||||||
| (local.get $struct) | ||||||||||||||
| ) | ||||||||||||||
| ) | ||||||||||||||
| ) | ||||||||||||||
| ) | ||||||||||||||
|
|
||||||||||||||
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.
Nit: Can we do this and remove
ret = getbelow?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.
That almost works, but we need the type to be more specific than
Expression*on line 441, where we usegetin a place that must beGlobalGet*.