nir: compute new range when shrinking push constants loads

Submitted by Samuel Pitoiset on Feb. 5, 2019, 2:53 p.m.

Details

Message ID 20190205145306.16445-1-samuel.pitoiset@gmail.com
State New
Headers show
Series "nir: compute new range when shrinking push constants loads" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Samuel Pitoiset Feb. 5, 2019, 2:53 p.m.
RADV will rely on that range for inlining push constants.

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

Patch hide | download patch | download mbox

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;
       }
    }