nir: Support casts in function_temp variables
This MR fixes a bunch of NIR optimizations previously assumed simple derefs only (because they only operate on
shader_temp variables) to do the right thing in the presence of casts. For all of them, the right thing to do is to bail and leave the variable alone. However, doing this correctly is a bit tricky in some cases.
To demonstrate this working, I have a hack patch on top which makes ANV optimize before function inlining. Currently this has 43 failures in CI and I think all of them are because
nir_opt_find_array_copies is dying. I'll get it fixed up eventually. For now, the important ones (
nir_opt_vars_to_ssa and the three in nir_split_vars.c) are working as intended.