[Mesa-dev] [PATCH] nir: compute new range when shrinking push constants loads

Samuel Pitoiset samuel.pitoiset at gmail.com
Tue Feb 5 14:53:06 UTC 2019


RADV will rely on that range for inlining push constants.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/compiler/nir/nir_opt_shrink_load.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/compiler/nir/nir_opt_shrink_load.c b/src/compiler/nir/nir_opt_shrink_load.c
index f97b7f9b67f..db1ae9aa24f 100644
--- a/src/compiler/nir/nir_opt_shrink_load.c
+++ b/src/compiler/nir/nir_opt_shrink_load.c
@@ -34,6 +34,11 @@ opt_shrink_load(nir_intrinsic_instr *instr)
       if (instr->num_components > util_last_bit(mask)) {
          instr->num_components = util_last_bit(mask);
          instr->dest.ssa.num_components = instr->num_components;
+
+         /* Compute and update range. */
+         int range = (instr->dest.ssa.bit_size / 8) * instr->num_components;
+         nir_intrinsic_set_range(instr, range);
+
          progress = true;
       }
    }
-- 
2.20.1



More information about the mesa-dev mailing list