brw: Get the reference to brw_def_analysis only once in saturate propagation

Instead of calling `require()` every instruction, call it once per pass.
Even though the defs are cached (i.e. we are not re-calculating them every
instruction), this prevents the extra check and the call to analysis
validation.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34010>
This commit is contained in:
Caio Oliveira
2025-03-11 13:36:46 -07:00
committed by Marge Bot
parent fb224e9016
commit 6e19215810
@@ -86,7 +86,9 @@ propagate_sat(brw_inst *inst, brw_inst *scan_inst)
}
static bool
opt_saturate_propagation_local(brw_shader &s, bblock_t *block)
opt_saturate_propagation_local(brw_shader &s,
const brw_def_analysis &defs,
bblock_t *block)
{
bool progress = false;
int ip = block->end_ip + 1;
@@ -102,7 +104,6 @@ opt_saturate_propagation_local(brw_shader &s, bblock_t *block)
inst->src[0].abs)
continue;
const brw_def_analysis &defs = s.def_analysis.require();
brw_inst *def = defs.get(inst->src[0]);
if (def != NULL) {
@@ -192,8 +193,10 @@ brw_opt_saturate_propagation(brw_shader &s)
{
bool progress = false;
const brw_def_analysis &defs = s.def_analysis.require();
foreach_block (block, s.cfg) {
progress = opt_saturate_propagation_local(s, block) || progress;
progress = opt_saturate_propagation_local(s, defs, block) || progress;
}
if (progress)