nir/opt_phi_precision: Work with libraries
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Tue, 5 Sep 2023 21:19:50 +0000 (17:19 -0400)
committerMarge Bot <emma+marge@anholt.net>
Thu, 12 Oct 2023 21:03:31 +0000 (21:03 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25625>

src/compiler/nir/nir_opt_phi_precision.c

index 9d41860..d1c74e0 100644 (file)
@@ -444,13 +444,10 @@ nir_opt_phi_precision(nir_shader *shader)
    unsigned bit_sizes_used = shader->info.bit_sizes_float |
                              shader->info.bit_sizes_int;
 
-   if (!bit_sizes_used) {
-      nir_shader_gather_info(shader, nir_shader_get_entrypoint(shader));
-      bit_sizes_used = shader->info.bit_sizes_float |
-                       shader->info.bit_sizes_int;
-   }
-
-   if (!(bit_sizes_used & (8 | 16)))
+   /* Note: if the info is zeroed, we conservatively run to avoid gathering
+    * info, which doesn't work for libraries.
+    */
+   if (bit_sizes_used && !(bit_sizes_used & (8 | 16)))
       return false;
 
    nir_foreach_function_impl(impl, shader) {