[Mesa-dev] [PATCH 2/2] nir/loop_analyze: handle swizzles on invariant

Timothy Arceri tarceri at itsqueeze.com
Wed Jun 19 03:41:08 UTC 2019


Fixes: 6772a17acc8e ("nir: Add a loop analysis pass")
---
 src/compiler/nir/nir_loop_analyze.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/compiler/nir/nir_loop_analyze.c b/src/compiler/nir/nir_loop_analyze.c
index ff73b32c51d..e85a404da1b 100644
--- a/src/compiler/nir/nir_loop_analyze.c
+++ b/src/compiler/nir/nir_loop_analyze.c
@@ -959,9 +959,10 @@ find_trip_count(loop_info_state *state)
          nir_instr_as_load_const(basic_ind->ind->def_outside_loop->
                                     def->parent_instr)->value;
 
+      unsigned invariant_swz = basic_ind->ind->invariant->swizzle[0];
       nir_const_value *step_val =
-         nir_instr_as_load_const(basic_ind->ind->invariant->src.ssa->
-                                 parent_instr)->value;
+         &(nir_instr_as_load_const(basic_ind->ind->invariant->src.ssa->
+                                   parent_instr)->value[invariant_swz]);
 
       int iterations = calculate_iterations(initial_val, step_val,
                                             &limit_val,
-- 
2.21.0



More information about the mesa-dev mailing list