[Mesa-dev] [PATCH 2/2] nir/loop_analyze: handle swizzles on the loop limit
Timothy Arceri
tarceri at itsqueeze.com
Wed Jun 19 08:09:00 UTC 2019
Fixes: 6772a17acc8e ("nir: Add a loop analysis pass")
---
src/compiler/nir/nir_loop_analyze.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/compiler/nir/nir_loop_analyze.c b/src/compiler/nir/nir_loop_analyze.c
index 57d2d94cad2..79ed5bb2712 100644
--- a/src/compiler/nir/nir_loop_analyze.c
+++ b/src/compiler/nir/nir_loop_analyze.c
@@ -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)
return false;
+ unsigned limit_swz = limit->swizzle[0];
*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;
@@ -933,8 +935,10 @@ find_trip_count(loop_info_state *state)
/* Attempt to find a constant limit for the loop */
nir_const_value limit_val;
if (limit->src.ssa->parent_instr->type == nir_instr_type_load_const) {
+ unsigned limit_swz = limit->swizzle[0];
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 {
trip_count_known = false;
--
2.21.0
More information about the mesa-dev
mailing list