Disregard this patch. I'm sending a replacement for it.
For the record:
> The pass works by walking through the control flow nodes, and traverse
> the instructions keeping track of the write instructions whose
> destination were not overwritten by other instructions (called "live
> writes").
> ---
> src/compiler/Makefile.sources | 1 +
> src/compiler/nir/meson.build | 1 +
> src/compiler/nir/nir.h | 2 +
> src/compiler/nir/nir_opt_copy_prop_vars.c | 67 +---
> src/compiler/nir/nir_opt_dead_write_vars.c | 379 +
Replaces the existing dead write var removal that is done as part of
nir_opt_copy_prop_vars pass. The previous pass was per-block, so
it would not remove the dead write in a program like
int total = gl_VertexIndex * 10;
float r = gl_VertexIndex;
for (int i = 0; i < total; i++) {