intel/nir: Call nir_metadata_preserve on !progress
authorJason Ekstrand <jason@jlekstrand.net>
Fri, 22 May 2020 01:41:28 +0000 (20:41 -0500)
committerMarge Bot <eric+marge@anholt.net>
Thu, 11 Jun 2020 05:08:12 +0000 (05:08 +0000)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5171>

src/intel/compiler/brw_nir_clamp_image_1d_2d_array_sizes.c
src/intel/compiler/brw_nir_lower_conversions.c
src/intel/compiler/brw_nir_lower_image_load_store.c
src/intel/compiler/brw_nir_lower_mem_access_bit_sizes.c
src/intel/compiler/brw_nir_opt_peephole_ffma.c

index d77955a2d5450ed723e0f0e6b649c0c19ee7b517..bc5e5864b6243db791e527fa2e25197cdfefe104 100644 (file)
@@ -132,6 +132,8 @@ brw_nir_clamp_image_1d_2d_array_sizes(nir_shader *shader)
          nir_metadata_preserve(func->impl, nir_metadata_block_index |
                                            nir_metadata_dominance);
          progress = function_progress;
+      } else {
+         nir_metadata_preserve(func->impl, nir_metadata_all);
       }
    }
 
index 9aff30b568b42f92e73f360f5b8b540a17b069fb..0febb1f913ef0585dfdd3e5d8689f46b5fb5d85c 100644 (file)
@@ -150,6 +150,8 @@ lower_impl(nir_function_impl *impl)
    if (progress) {
       nir_metadata_preserve(impl, nir_metadata_block_index |
                                   nir_metadata_dominance);
+   } else {
+      nir_metadata_preserve(impl, nir_metadata_all);
    }
 
    return progress;
index 88b756b0775feebf7b0b2c8bd3fcc3b9e831d979..1825c2f02212679b34c7dbf5c6ce6027f1839afc 100644 (file)
@@ -689,6 +689,7 @@ brw_nir_lower_image_load_store(nir_shader *shader,
       if (function->impl == NULL)
          continue;
 
+      bool impl_progress = false;
       nir_foreach_block_safe(block, function->impl) {
          nir_builder b;
          nir_builder_init(&b, function->impl);
@@ -701,12 +702,12 @@ brw_nir_lower_image_load_store(nir_shader *shader,
             switch (intrin->intrinsic) {
             case nir_intrinsic_image_deref_load:
                if (lower_image_load_instr(&b, devinfo, intrin))
-                  progress = true;
+                  impl_progress = true;
                break;
 
             case nir_intrinsic_image_deref_store:
                if (lower_image_store_instr(&b, devinfo, intrin))
-                  progress = true;
+                  impl_progress = true;
                break;
 
             case nir_intrinsic_image_deref_atomic_add:
@@ -722,12 +723,12 @@ brw_nir_lower_image_load_store(nir_shader *shader,
                if (uses_atomic_load_store)
                   *uses_atomic_load_store = true;
                if (lower_image_atomic_instr(&b, devinfo, intrin))
-                  progress = true;
+                  impl_progress = true;
                break;
 
             case nir_intrinsic_image_deref_size:
                if (lower_image_size_instr(&b, devinfo, intrin))
-                  progress = true;
+                  impl_progress = true;
                break;
 
             default:
@@ -737,8 +738,12 @@ brw_nir_lower_image_load_store(nir_shader *shader,
          }
       }
 
-      if (progress)
+      if (impl_progress) {
+         progress = true;
          nir_metadata_preserve(function->impl, nir_metadata_none);
+      } else {
+         nir_metadata_preserve(function->impl, nir_metadata_all);
+      }
    }
 
    return progress;
index 19abc16a9c58dc16e94f28fed0299aec7ef6e6a4..f67a414e873083309a223931ceb8897836615a2a 100644 (file)
@@ -275,6 +275,8 @@ lower_mem_access_bit_sizes_impl(nir_function_impl *impl,
    if (progress) {
       nir_metadata_preserve(impl, nir_metadata_block_index |
                                   nir_metadata_dominance);
+   } else {
+      nir_metadata_preserve(impl, nir_metadata_all);
    }
 
    return progress;
index 45a5f56c8aab6475e8df9d5a9c625fd17a5b75a9..813ede4c1cb69c90371ec47fcdd77cb698f084f0 100644 (file)
@@ -277,9 +277,12 @@ brw_nir_opt_peephole_ffma_impl(nir_function_impl *impl)
       progress |= brw_nir_opt_peephole_ffma_block(&builder, block);
    }
 
-   if (progress)
+   if (progress) {
       nir_metadata_preserve(impl, nir_metadata_block_index |
                                   nir_metadata_dominance);
+   } else {
+      nir_metadata_preserve(impl, nir_metadata_all);
+   }
 
    return progress;
 }