[2/2] nir/loop_analyze: handle swizzles on invariant

Submitted by Timothy Arceri on June 19, 2019, 3:41 a.m.

Details

Message ID 20190619034108.13900-2-tarceri@itsqueeze.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

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

Patch hide | download patch | download mbox

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,