Commit c91988cf authored by Jesse Natalie's avatar Jesse Natalie Committed by Erik Faye-Lund
Browse files

microsoft/clc: Do some real optimizations after inlining

Before doing ower lower_explicit_io, let's go ahead and do a first round
of optimizations.
parent aedf2817
...@@ -1281,19 +1281,56 @@ clc_to_dxil(struct clc_context *ctx, ...@@ -1281,19 +1281,56 @@ clc_to_dxil(struct clc_context *ctx,
i++; i++;
} }
{
bool progress;
do
{
progress = false;
NIR_PASS(progress, nir, nir_copy_prop);
NIR_PASS(progress, nir, nir_opt_copy_prop_vars);
NIR_PASS(progress, nir, nir_opt_deref);
NIR_PASS(progress, nir, nir_opt_dce);
NIR_PASS(progress, nir, nir_opt_undef);
NIR_PASS(progress, nir, nir_opt_constant_folding);
NIR_PASS(progress, nir, nir_opt_cse);
NIR_PASS(progress, nir, nir_lower_vars_to_ssa);
NIR_PASS(progress, nir, nir_opt_algebraic);
} while (progress);
}
// Inline all functions first. // Inline all functions first.
// according to the comment on nir_inline_functions // according to the comment on nir_inline_functions
NIR_PASS_V(nir, nir_lower_variable_initializers, nir_var_function_temp); NIR_PASS_V(nir, nir_lower_variable_initializers, nir_var_function_temp);
NIR_PASS_V(nir, nir_lower_returns); NIR_PASS_V(nir, nir_lower_returns);
NIR_PASS_V(nir, nir_lower_libclc, ctx->libclc_nir); NIR_PASS_V(nir, nir_lower_libclc, ctx->libclc_nir);
NIR_PASS_V(nir, nir_inline_functions); NIR_PASS_V(nir, nir_inline_functions);
NIR_PASS_V(nir, nir_copy_prop);
NIR_PASS_V(nir, nir_opt_deref); {
NIR_PASS_V(nir, nir_opt_dce); bool progress;
do
{
progress = false;
NIR_PASS(progress, nir, nir_copy_prop);
NIR_PASS(progress, nir, nir_opt_copy_prop_vars);
NIR_PASS(progress, nir, nir_opt_deref);
NIR_PASS(progress, nir, nir_opt_dce);
NIR_PASS(progress, nir, nir_opt_undef);
NIR_PASS(progress, nir, nir_opt_constant_folding);
NIR_PASS(progress, nir, nir_opt_cse);
NIR_PASS(progress, nir, nir_split_var_copies);
NIR_PASS(progress, nir, nir_lower_var_copies);
NIR_PASS(progress, nir, nir_lower_vars_to_ssa);
NIR_PASS(progress, nir, nir_opt_algebraic);
NIR_PASS(progress, nir, nir_opt_if, true);
NIR_PASS(progress, nir, nir_opt_dead_cf);
NIR_PASS(progress, nir, nir_opt_remove_phis);
NIR_PASS(progress, nir, nir_opt_peephole_select, 8, true, true);
} while (progress);
}
// Before removing dead uniforms, dedupe constant samplers to make more dead uniforms // Before removing dead uniforms, dedupe constant samplers to make more dead uniforms
NIR_PASS_V(nir, clc_nir_dedupe_const_samplers); NIR_PASS_V(nir, clc_nir_dedupe_const_samplers);
NIR_PASS_V(nir, nir_remove_dead_variables, nir_var_uniform | nir_var_mem_ubo | nir_var_mem_constant); NIR_PASS_V(nir, nir_remove_dead_variables, nir_var_uniform | nir_var_mem_ubo | nir_var_mem_constant | nir_var_function_temp);
NIR_PASS_V(nir, scale_fdiv); NIR_PASS_V(nir, scale_fdiv);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment