SimplifyGlobals: Propagate constant globals into nested gets in other globals#6285
SimplifyGlobals: Propagate constant globals into nested gets in other globals#6285kripken merged 2 commits intoWebAssembly:mainfrom
Conversation
| return; | ||
| } | ||
| if (auto* get = init->dynCast<GlobalGet>()) { | ||
| for (auto** getp : FindAllPointers<GlobalGet>(init).list) { |
There was a problem hiding this comment.
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.
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.
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.gets.
There was a problem hiding this comment.
What do you mean by "does not interfere"? Like if it is in the middle between them?
There was a problem hiding this comment.
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.