Commit 0f5c74d8 authored by Timothy Arceri's avatar Timothy Arceri

nir/loop_analyze: handle swizzles on the loop limit

Fixes: 6772a17a ("nir: Add a loop analysis pass")
Tested-by: Brian Paul's avatarBrian Paul <brianp@vmware.com>
parent 6ee11de0
...@@ -561,8 +561,10 @@ try_find_limit_of_alu(nir_alu_src *limit, nir_const_value *limit_val, ...@@ -561,8 +561,10 @@ try_find_limit_of_alu(nir_alu_src *limit, nir_const_value *limit_val,
if (limit->src.ssa->parent_instr->type != nir_instr_type_load_const) if (limit->src.ssa->parent_instr->type != nir_instr_type_load_const)
return false; return false;
unsigned limit_swz = limit->swizzle[0];
*limit_val = *limit_val =
nir_instr_as_load_const(limit->src.ssa->parent_instr)->value[0]; nir_instr_as_load_const(limit->src.ssa->parent_instr)
->value[limit_swz];
terminator->exact_trip_count_unknown = true; terminator->exact_trip_count_unknown = true;
...@@ -933,8 +935,10 @@ find_trip_count(loop_info_state *state) ...@@ -933,8 +935,10 @@ find_trip_count(loop_info_state *state)
/* Attempt to find a constant limit for the loop */ /* Attempt to find a constant limit for the loop */
nir_const_value limit_val; nir_const_value limit_val;
if (limit->src.ssa->parent_instr->type == nir_instr_type_load_const) { if (limit->src.ssa->parent_instr->type == nir_instr_type_load_const) {
unsigned limit_swz = limit->swizzle[0];
limit_val = limit_val =
nir_instr_as_load_const(limit->src.ssa->parent_instr)->value[0]; nir_instr_as_load_const(limit->src.ssa->parent_instr)
->value[limit_swz];
} else { } else {
trip_count_known = false; trip_count_known = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment