nir/opt_intrinsics: Rework progress
This commit fixes two issues: First, we were returning false regardless of whether or not the function made progress. Second, we were calling nir_metadata_preserve far more often than needed; we only need to call it once per impl. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
This commit is contained in:
parent
d24311b7b5
commit
e0519294c7
|
@ -121,8 +121,6 @@ opt_intrinsics_impl(nir_function_impl *impl)
|
||||||
nir_ssa_def_rewrite_uses(&intrin->dest.ssa,
|
nir_ssa_def_rewrite_uses(&intrin->dest.ssa,
|
||||||
nir_src_for_ssa(replacement));
|
nir_src_for_ssa(replacement));
|
||||||
nir_instr_remove(instr);
|
nir_instr_remove(instr);
|
||||||
nir_metadata_preserve(impl, nir_metadata_block_index |
|
|
||||||
nir_metadata_dominance);
|
|
||||||
progress = true;
|
progress = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -136,9 +134,15 @@ nir_opt_intrinsics(nir_shader *shader)
|
||||||
bool progress = false;
|
bool progress = false;
|
||||||
|
|
||||||
nir_foreach_function(function, shader) {
|
nir_foreach_function(function, shader) {
|
||||||
if (function->impl)
|
if (!function->impl)
|
||||||
progress |= opt_intrinsics_impl(function->impl);
|
continue;
|
||||||
|
|
||||||
|
if (opt_intrinsics_impl(function->impl)) {
|
||||||
|
progress = true;
|
||||||
|
nir_metadata_preserve(function->impl, nir_metadata_block_index |
|
||||||
|
nir_metadata_dominance);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return progress;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue