nir: clarify and update loop conditional instruction

This value is intended to be used to remove out of bounds array
access when unrolling loops so it should contain the comparison
that contains the the induction variable not the overall
condition of the loop terminator. So here we update the instruction
when dealing with iand/ior loop terminator conditions.

Acked-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28998>
This commit is contained in:
Timothy Arceri 2024-04-24 14:46:25 +10:00 committed by Marge Bot
parent 5ac539d70d
commit 9702570994
2 changed files with 2 additions and 1 deletions

View file

@ -3153,7 +3153,7 @@ typedef struct nir_if {
typedef struct {
nir_if *nif;
/** Instruction that generates nif::condition. */
/** Condition instruction that contains the induction variable */
nir_instr *conditional_instr;
/** Block within ::nif that has the break instruction. */

View file

@ -1259,6 +1259,7 @@ find_trip_count(loop_info_state *state, unsigned execution_mode,
alu_op = nir_scalar_alu_op(cond);
invert_cond = !invert_cond;
trip_count_known = false;
terminator->conditional_instr = cond.def->parent_instr;
terminator->exact_trip_count_unknown = true;
}