From: Eric Anholt Date: Wed, 5 Jun 2019 18:43:13 +0000 (-0700) Subject: freedreno: Remove silly return from ir3_optimize_nir(). X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=01d0bad9efa1973293920f3c2bae78fca807f204;p=mesa.git freedreno: Remove silly return from ir3_optimize_nir(). We only ever return the shader we were passed in (but internally modified). Reviewed-by: Rob Clark Reviewed-by: Kristian H. Kristensen --- diff --git a/src/freedreno/ir3/ir3_context.c b/src/freedreno/ir3/ir3_context.c index 49a7776164e..dc9ed10d844 100644 --- a/src/freedreno/ir3/ir3_context.c +++ b/src/freedreno/ir3/ir3_context.c @@ -71,13 +71,9 @@ ir3_context_init(struct ir3_compiler *compiler, * creating duplicate variants.. */ - if (ir3_key_lowers_nir(&so->key)) { - nir_shader *s = nir_shader_clone(ctx, so->shader->nir); - ctx->s = ir3_optimize_nir(so->shader, s, &so->key); - } else { - /* fast-path for shader key that lowers nothing in NIR: */ - ctx->s = nir_shader_clone(ctx, so->shader->nir); - } + ctx->s = nir_shader_clone(ctx, so->shader->nir); + if (ir3_key_lowers_nir(&so->key)) + ir3_optimize_nir(so->shader, ctx->s, &so->key); /* this needs to be the last pass run, so do this here instead of * in ir3_optimize_nir(): diff --git a/src/freedreno/ir3/ir3_nir.c b/src/freedreno/ir3/ir3_nir.c index 23dabee1fb0..cb97a2202ed 100644 --- a/src/freedreno/ir3/ir3_nir.c +++ b/src/freedreno/ir3/ir3_nir.c @@ -174,7 +174,7 @@ ir3_optimize_loop(nir_shader *s) } while (progress); } -struct nir_shader * +void ir3_optimize_nir(struct ir3_shader *shader, nir_shader *s, const struct ir3_shader_key *key) { @@ -281,8 +281,6 @@ ir3_optimize_nir(struct ir3_shader *shader, nir_shader *s, if (!key) { ir3_setup_const_state(shader, s); } - - return s; } static void diff --git a/src/freedreno/ir3/ir3_nir.h b/src/freedreno/ir3/ir3_nir.h index 6314c097956..a9b39e235b5 100644 --- a/src/freedreno/ir3/ir3_nir.h +++ b/src/freedreno/ir3/ir3_nir.h @@ -43,7 +43,7 @@ bool ir3_nir_move_varying_inputs(nir_shader *shader); const nir_shader_compiler_options * ir3_get_compiler_options(struct ir3_compiler *compiler); bool ir3_key_lowers_nir(const struct ir3_shader_key *key); -struct nir_shader * ir3_optimize_nir(struct ir3_shader *shader, nir_shader *s, +void ir3_optimize_nir(struct ir3_shader *shader, nir_shader *s, const struct ir3_shader_key *key); bool ir3_nir_analyze_ubo_ranges(nir_shader *nir, struct ir3_shader *shader); diff --git a/src/freedreno/ir3/ir3_shader.c b/src/freedreno/ir3/ir3_shader.c index 228c7609f50..f366332c303 100644 --- a/src/freedreno/ir3/ir3_shader.c +++ b/src/freedreno/ir3/ir3_shader.c @@ -292,7 +292,9 @@ ir3_shader_from_nir(struct ir3_compiler *compiler, nir_shader *nir) NIR_PASS_V(nir, nir_lower_io_arrays_to_elements_no_indirects, false); /* do first pass optimization, ignoring the key: */ - shader->nir = ir3_optimize_nir(shader, nir, NULL); + ir3_optimize_nir(shader, nir, NULL); + + shader->nir = nir; if (ir3_shader_debug & IR3_DBG_DISASM) { printf("dump nir%d: type=%d", shader->id, shader->type); nir_print_shader(shader->nir, stdout); diff --git a/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c b/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c index 34b39aa65f0..f8acc480d69 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c @@ -490,7 +490,9 @@ int main(int argc, char **argv) } s.compiler = compiler; - s.nir = ir3_optimize_nir(&s, nir, NULL); + s.nir = nir; + + ir3_optimize_nir(&s, nir, NULL); v.key = key; v.shader = &s;