-
Notifications
You must be signed in to change notification settings - Fork 831
[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
Conversation
| assert(value.globals.size() == 1); | ||
| // Create a global.get with temporary name, leaving only the | ||
| // updating of the name to later work. | ||
| auto* get = builder.makeGlobalGet(value.globals[0], |
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.
| auto* get = builder.makeGlobalGet(value.globals[0], | |
| ret = builder.makeGlobalGet(value.globals[0], |
Nit: Can we do this and remove ret = get below?
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 use get in a place that must be GlobalGet*.
| ;; 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 |
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.
Why did the select have debug info even before this PR (and not the children)?
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.
The select received it because replaceCurrent copies debug info, and we replace the struct.get with the select. But it doesn't copy recursively into children (we've considered that before, but it's not clear if it's correct, and would be slower).
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 thought we were doing that..?
Lines 125 to 129 in cdf8139
| // Copy debug info, if present. | |
| if (currFunction) { | |
| debuginfo::copyOriginalToReplacement( | |
| getCurrent(), expression, currFunction); | |
| } |
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 not recursively, just on the replacement:
Line 43 in cdf8139
| debugLocations[replacement] = iter->second; |
So the select gets it, but not the select's children.
Previously the replacement select got the debug info, but we should also copy it
to the values, as often optimizations lead to one of those values remaining by
itself.
Similar to #6652 in general form.
Diff without whitespace is much shorter.
See the very last commit to see the impact on the new test.