slang icon indicating copy to clipboard operation
slang copied to clipboard

Hoist resource variables using a global initializer function correctly

Open ArielG-NV opened this issue 6 months ago • 3 comments

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:

  1. If legalize a global kIROp and it creates a global, make a GlobalVar

[only done for resource variables for simplicity of legalization pass]

  1. Add a legalization pass that moves any global GlobalVar stores (initializers) into the GlobalVar init block
  2. 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.

ArielG-NV avatar Aug 21 '24 04:08 ArielG-NV