spirv: Emit switch conditions on-the-fly

Graphics / Mesa 3D Graphics Library / Mesa - Jason Ekstrand [intel.com] - 12 January 2019 23:55 EST

Instead of emitting all of the conditions for the cases of a switch statement up-front, emit them on-the-fly as we emit the code for each case. The original justification for this was that we were going to have to build a default case anyway which would need them all. However, we can just trust CSE to clean up the mess in that case. Emitting each condition right before the if statement that uses it reduces register pressure and, in one customer benchmark, reduces spilling and improves performance by about 2x.

b938d5fbef spirv: Emit switch conditions on-the-fly
src/compiler/spirv/vtn_cfg.c | 62 +++++++++++++++++++-------------------------
1 file changed, 26 insertions(+), 36 deletions(-)

Upstream: cgit.freedesktop.org

  • Share