From: Jason Ekstrand Date: Tue, 24 Jul 2018 17:08:20 +0000 (-0700) Subject: intel/nir: Use the new structure and array splitting passes X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=02a5442dd7a76905ad906cd80e57c019a83144b0;p=mesa.git intel/nir: Use the new structure and array splitting passes We call structure splitting once because it is guaranteed to split all the structures in the entire shader in one go. We call array splitting in the loop in case future optimizations turn indirects into direct dereferences and we can split more arrays. Shader-db results on Kaby Lake: total instructions in shared programs: 15177605 -> 15177605 (0.00%) instructions in affected programs: 0 -> 0 helped: 0 HURT: 0 This is unsurprising because nir_lower_vars_to_ssa already effectively does structure and array splitting internally. It doesn't actually split the variables but it's ability to reason about aliasing in the presence of arrays and structures and pick out scalars or vectors to be lowered to SSA values is fairly advanced. Reviewed-by: Caio Marcelo de Oliveira Filho --- diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c index 29ad68fdb2a..cb5f18eb69b 100644 --- a/src/intel/compiler/brw_nir.c +++ b/src/intel/compiler/brw_nir.c @@ -541,6 +541,7 @@ brw_nir_optimize(nir_shader *nir, const struct brw_compiler *compiler, bool progress; do { progress = false; + OPT(nir_split_array_vars, nir_var_local); OPT(nir_lower_vars_to_ssa); OPT(nir_opt_copy_prop_vars); @@ -648,6 +649,7 @@ brw_preprocess_nir(const struct brw_compiler *compiler, nir_shader *nir) OPT(nir_lower_global_vars_to_local); OPT(nir_split_var_copies); + OPT(nir_split_struct_vars, nir_var_local); /* Run opt_algebraic before int64 lowering so we can hopefully get rid * of some int64 instructions.