-
Notifications
You must be signed in to change notification settings - Fork 747
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
SimplifyGlobals: Propagate constant globals into nested gets in other globals #6285
Conversation
@@ -659,10 +660,11 @@ struct SimplifyGlobals : public Pass { | |||
// This is the init of a passive segment, which is null. | |||
return; | |||
} | |||
if (auto* get = init->dynCast<GlobalGet>()) { | |||
for (auto** getp : FindAllPointers<GlobalGet>(init).list) { |
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.
As a separate cleanup it might be nice to use the template parameter on FindAllPointers
in the type of its list
to avoid the need for a cast 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.
I'll try, though I have a vague memory of that not working for a sad C++ey reason...
(global $struct (ref $struct) (struct.new $struct | ||
(global.get $a) | ||
(global.get $b) | ||
)) |
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'm sure this is already tested elsewhere, but it might be nice to see that a global.get
where the value cannot be propagated (because it is a GC data allocation, for instance) does not interfere with propagation of the other global.get
s.
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.
What do you mean by "does not interfere"? Like if it is in the middle between 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.
Not in the middle, necessarily, but yeah, if this struct had another field initialized with another global.get
, but that one couldn't be propagated.
… globals (WebAssembly#6285) Before we propagated to the top level, but not to anything interior.
Before we propagated to the top level, but not to anything interior.