slang
slang copied to clipboard
Hoist resource variables using a global initializer function correctly
Fixes: #4874 Goal: Hoist resource variables using a global initializer function in such a way that any global with initializer function has any possible resource variables hoisted into their use location directly (otherwise many targets won't work). Changes:
- If legalize a global kIROp and it creates a global, make a GlobalVar
[only done for resource variables for simplicity of legalization pass]
- Add a legalization pass that moves any global GlobalVar stores (initializers) into the GlobalVar init block
- If we have a GlobalVar which is computed to be an alias (direct assignment to another variable), hoist the alias's value into IRGlobalVar use-sites.