intel/compiler: Fold constants after distributing source modifiers
This can generate things like fneg! of load_const, which is silly. Fold those away into an actual constant. Only do so on the scalar backend because there's a comment above that the vec4 backend doesn't want any new constants this late, and I'm inclined to believe it. fossil-db stats show a very minor improvement: Totals: Instrs: 203091223 -> 203091099 (-0.00%); split: -0.00%, +0.00% Cycles: 14410638075 -> 14410577067 (-0.00%); split: -0.00%, +0.00% Totals from 20 (0.00% of 665070) affected shaders: Instrs: 27067 -> 26943 (-0.46%); split: -0.47%, +0.01% Cycles: 2687958 -> 2626950 (-2.27%); split: -2.27%, +0.00% Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22881>
This commit is contained in:
@@ -1639,6 +1639,9 @@ brw_postprocess_nir(nir_shader *nir, const struct brw_compiler *compiler,
|
||||
OPT(nir_lower_alu_to_scalar, NULL, NULL);
|
||||
|
||||
while (OPT(nir_opt_algebraic_distribute_src_mods)) {
|
||||
if (is_scalar)
|
||||
OPT(nir_opt_constant_folding);
|
||||
|
||||
OPT(nir_copy_prop);
|
||||
OPT(nir_opt_dce);
|
||||
OPT(nir_opt_cse);
|
||||
|
Reference in New Issue
Block a user