tree-wide: don't call nir_opt_constant_folding after nir_lower_flrp

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37195>
This commit is contained in:
Daniel Schürmann 2025-10-15 12:16:48 +02:00 committed by Marge Bot
parent 9039e24751
commit 10be538851
10 changed files with 14 additions and 66 deletions

View file

@ -733,12 +733,8 @@ radv_shader_spirv_to_nir(struct radv_device *device, const struct radv_shader_st
unsigned lower_flrp = (nir->options->lower_flrp16 ? 16 : 0) | (nir->options->lower_flrp32 ? 32 : 0) |
(nir->options->lower_flrp64 ? 64 : 0);
if (lower_flrp != 0) {
progress = false;
if (lower_flrp != 0)
NIR_PASS(progress, nir, nir_lower_flrp, lower_flrp, false /* always precise */);
if (progress)
NIR_PASS(_, nir, nir_opt_constant_folding);
}
NIR_PASS(_, nir, nir_lower_explicit_io, nir_var_mem_push_const, nir_address_format_32bit_offset);

View file

@ -2236,15 +2236,8 @@ v3d_optimize_nir(struct v3d_compile *c, struct nir_shader *s)
}
if (lower_flrp != 0) {
bool lower_flrp_progress = false;
NIR_PASS(lower_flrp_progress, s, nir_lower_flrp,
lower_flrp,
false /* always_precise */);
if (lower_flrp_progress) {
NIR_PASS(progress, s, nir_opt_constant_folding);
progress = true;
}
NIR_PASS(progress, s, nir_lower_flrp,
lower_flrp, false /* always_precise */);
/* Nothing should rematerialize any flrps, so we only
* need to do this lowering once.

View file

@ -111,16 +111,8 @@ gl_nir_opts(nir_shader *nir)
(nir->options->lower_flrp64 ? 64 : 0);
if (lower_flrp) {
bool lower_flrp_progress = false;
NIR_PASS(lower_flrp_progress, nir, nir_lower_flrp,
lower_flrp,
false /* always_precise */);
if (lower_flrp_progress) {
NIR_PASS(progress, nir,
nir_opt_constant_folding);
progress = true;
}
NIR_PASS(progress, nir, nir_lower_flrp,
lower_flrp, false /* always_precise */);
}
/* Nothing should rematerialize any flrps, so we only need to do this

View file

@ -397,10 +397,7 @@ ir3_optimize_loop(struct ir3_compiler *compiler,
progress |= OPT(s, nir_opt_offsets, &offset_options);
if (lower_flrp != 0) {
if (OPT(s, nir_lower_flrp, lower_flrp, false /* always_precise */)) {
OPT(s, nir_opt_constant_folding);
progress = true;
}
OPT(s, nir_lower_flrp, lower_flrp, false /* always_precise */);
/* Nothing should rematerialize any flrps, so we only
* need to do this lowering once.

View file

@ -2440,16 +2440,8 @@ ttn_optimize_nir(nir_shader *nir)
(nir->options->lower_flrp64 ? 64 : 0);
if (lower_flrp) {
bool lower_flrp_progress = false;
NIR_PASS(lower_flrp_progress, nir, nir_lower_flrp,
lower_flrp,
false /* always_precise */);
if (lower_flrp_progress) {
NIR_PASS(progress, nir,
nir_opt_constant_folding);
progress = true;
}
NIR_PASS(progress, nir, nir_lower_flrp,
lower_flrp, false /* always_precise */);
}
/* Nothing should rematerialize any flrps, so we only need to do this

View file

@ -99,13 +99,7 @@ void si_nir_opts(struct si_screen *sscreen, struct nir_shader *nir, bool has_arr
(nir->options->lower_flrp32 ? 32 : 0) |
(nir->options->lower_flrp64 ? 64 : 0);
assert(lower_flrp);
bool lower_flrp_progress = false;
NIR_PASS(lower_flrp_progress, nir, nir_lower_flrp, lower_flrp, false /* always_precise */);
if (lower_flrp_progress) {
NIR_PASS(progress, nir, nir_opt_constant_folding);
progress = true;
}
NIR_PASS(progress, nir, nir_lower_flrp, lower_flrp, false /* always_precise */);
/* Nothing should rematerialize any flrps, so we only
* need to do this lowering once.

View file

@ -1512,15 +1512,8 @@ vc4_optimize_nir(struct nir_shader *s)
NIR_PASS(progress, s, nir_opt_algebraic);
NIR_PASS(progress, s, nir_opt_constant_folding);
if (lower_flrp != 0) {
bool lower_flrp_progress = false;
NIR_PASS(lower_flrp_progress, s, nir_lower_flrp,
lower_flrp,
false /* always_precise */);
if (lower_flrp_progress) {
NIR_PASS(progress, s, nir_opt_constant_folding);
progress = true;
}
NIR_PASS(progress, s, nir_lower_flrp,
lower_flrp, false /* always_precise */);
/* Nothing should rematerialize any flrps, so we only
* need to do this lowering once.

View file

@ -1101,11 +1101,7 @@ brw_nir_optimize(nir_shader *nir,
LOOP_OPT(nir_opt_constant_folding);
if (lower_flrp != 0) {
if (LOOP_OPT(nir_lower_flrp,
lower_flrp,
false /* always_precise */)) {
LOOP_OPT(nir_opt_constant_folding);
}
LOOP_OPT(nir_lower_flrp, lower_flrp, false /* always_precise */);
/* Nothing should rematerialize any flrps, so we only need to do this
* lowering once.

View file

@ -756,11 +756,7 @@ elk_nir_optimize(nir_shader *nir, bool is_scalar,
OPT(nir_opt_constant_folding);
if (lower_flrp != 0) {
if (OPT(nir_lower_flrp,
lower_flrp,
false /* always_precise */)) {
OPT(nir_opt_constant_folding);
}
OPT(nir_lower_flrp, lower_flrp, false /* always_precise */);
/* Nothing should rematerialize any flrps, so we only need to do this
* lowering once.

View file

@ -188,8 +188,7 @@ optimize_nir(nir_shader *nir, const struct nak_compiler *nak, bool allow_copies)
OPT(nir, nir_opt_constant_folding);
if (lower_flrp != 0) {
if (OPT(nir, nir_lower_flrp, lower_flrp, false /* always_precise */))
OPT(nir, nir_opt_constant_folding);
OPT(nir, nir_lower_flrp, lower_flrp, false /* always_precise */);
/* Nothing should rematerialize any flrps */
lower_flrp = 0;
}