nir: Add bool return value to nir_legacy_trivialize(..)

Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33686>
This commit is contained in:
Corentin Noël 2025-02-22 14:27:35 +01:00 committed by Marge Bot
parent 8eae89f3f0
commit eb1274ef08
2 changed files with 6 additions and 3 deletions

View file

@ -321,9 +321,10 @@ fuse_mods_with_registers(nir_builder *b, nir_instr *instr, void *fuse_fabs_)
return false;
}
void
bool
nir_legacy_trivialize(nir_shader *s, bool fuse_fabs)
{
bool progress = false;
/* First, fuse modifiers with registers. This ensures that the helpers do not
* chase registers recursively, allowing registers to be trivialized easier.
*/
@ -332,8 +333,10 @@ nir_legacy_trivialize(nir_shader *s, bool fuse_fabs)
&fuse_fabs)) {
/* If we made progress, we likely left dead loads. Clean them up. */
NIR_PASS(_, s, nir_opt_dce);
progress = true;
}
/* Now that modifiers are dealt with, we can trivialize the regular way. */
NIR_PASS(_, s, nir_trivialize_registers);
NIR_PASS(progress, s, nir_trivialize_registers);
return progress;
}

View file

@ -73,7 +73,7 @@ typedef struct {
} nir_legacy_alu_dest;
/* Prepare shader for use with legacy helpers. Must call on final NIR. */
void nir_legacy_trivialize(nir_shader *s, bool fuse_fabs);
bool nir_legacy_trivialize(nir_shader *s, bool fuse_fabs);
/* Reconstruct a legacy source/destination (including registers) */
nir_legacy_src nir_legacy_chase_src(const nir_src *src);