diff options
author | Jason Ekstrand <[email protected]> | 2017-08-22 12:18:32 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2017-10-25 16:14:09 -0700 |
commit | e0519294c7f416beb726d0e1463520f3166637d6 (patch) | |
tree | facd74d193f75beee9b073d7dda201e89b30dfb3 | |
parent | d24311b7b55d1dec1ce85e046619d05fa96ed99e (diff) |
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 <[email protected]>
-rw-r--r-- | src/compiler/nir/nir_opt_intrinsics.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/compiler/nir/nir_opt_intrinsics.c b/src/compiler/nir/nir_opt_intrinsics.c index f12dc8779cb..26a0f9650ad 100644 --- a/src/compiler/nir/nir_opt_intrinsics.c +++ b/src/compiler/nir/nir_opt_intrinsics.c @@ -121,8 +121,6 @@ opt_intrinsics_impl(nir_function_impl *impl) nir_ssa_def_rewrite_uses(&intrin->dest.ssa, nir_src_for_ssa(replacement)); nir_instr_remove(instr); - nir_metadata_preserve(impl, nir_metadata_block_index | - nir_metadata_dominance); progress = true; } } @@ -136,9 +134,15 @@ nir_opt_intrinsics(nir_shader *shader) bool progress = false; nir_foreach_function(function, shader) { - if (function->impl) - progress |= opt_intrinsics_impl(function->impl); + if (!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; } |