From: Jason Ekstrand Date: Fri, 22 May 2020 01:41:28 +0000 (-0500) Subject: intel/nir: Call nir_metadata_preserve on !progress X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=92cfbb7d0ce3012684f07ace5b09c0a607258b62;p=mesa.git intel/nir: Call nir_metadata_preserve on !progress Reviewed-by: Kenneth Graunke Part-of: --- diff --git a/src/intel/compiler/brw_nir_clamp_image_1d_2d_array_sizes.c b/src/intel/compiler/brw_nir_clamp_image_1d_2d_array_sizes.c index d77955a2d54..bc5e5864b62 100644 --- a/src/intel/compiler/brw_nir_clamp_image_1d_2d_array_sizes.c +++ b/src/intel/compiler/brw_nir_clamp_image_1d_2d_array_sizes.c @@ -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); } } diff --git a/src/intel/compiler/brw_nir_lower_conversions.c b/src/intel/compiler/brw_nir_lower_conversions.c index 9aff30b568b..0febb1f913e 100644 --- a/src/intel/compiler/brw_nir_lower_conversions.c +++ b/src/intel/compiler/brw_nir_lower_conversions.c @@ -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; diff --git a/src/intel/compiler/brw_nir_lower_image_load_store.c b/src/intel/compiler/brw_nir_lower_image_load_store.c index 88b756b0775..1825c2f0221 100644 --- a/src/intel/compiler/brw_nir_lower_image_load_store.c +++ b/src/intel/compiler/brw_nir_lower_image_load_store.c @@ -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; diff --git a/src/intel/compiler/brw_nir_lower_mem_access_bit_sizes.c b/src/intel/compiler/brw_nir_lower_mem_access_bit_sizes.c index 19abc16a9c5..f67a414e873 100644 --- a/src/intel/compiler/brw_nir_lower_mem_access_bit_sizes.c +++ b/src/intel/compiler/brw_nir_lower_mem_access_bit_sizes.c @@ -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; diff --git a/src/intel/compiler/brw_nir_opt_peephole_ffma.c b/src/intel/compiler/brw_nir_opt_peephole_ffma.c index 45a5f56c8aa..813ede4c1cb 100644 --- a/src/intel/compiler/brw_nir_opt_peephole_ffma.c +++ b/src/intel/compiler/brw_nir_opt_peephole_ffma.c @@ -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; }