tu: Actually remove dead variables after io lowering
authorConnor Abbott <cwabbott0@gmail.com>
Wed, 17 Jun 2020 13:39:18 +0000 (15:39 +0200)
committerMarge Bot <eric+marge@anholt.net>
Wed, 17 Jun 2020 14:36:50 +0000 (14:36 +0000)
I forgot that their derefs would still be lying around, so we need to
eliminate them first.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5519>

src/freedreno/vulkan/tu_shader.c

index b5d492aed0f18d60ce28be95ee017563d074e8ad..54ea0b86d2198929fa8cf1be7737d405c90f7d3f 100644 (file)
@@ -484,9 +484,14 @@ tu_lower_io(nir_shader *shader, struct tu_shader *tu_shader,
    /* Remove now-unused variables so that when we gather the shader info later
     * they won't be counted.
     */
-   nir_remove_dead_variables(shader,
-                             nir_var_uniform | nir_var_mem_ubo | nir_var_mem_ssbo,
-                             NULL);
+
+   if (progress)
+      nir_opt_dce(shader);
+
+   progress |=
+      nir_remove_dead_variables(shader,
+                                nir_var_uniform | nir_var_mem_ubo | nir_var_mem_ssbo,
+                                NULL);
 
    return progress;
 }