summaryrefslogtreecommitdiffstats
path: root/src/freedreno
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2019-06-05 11:43:13 -0700
committerEric Anholt <[email protected]>2019-06-21 17:14:43 -0700
commit01d0bad9efa1973293920f3c2bae78fca807f204 (patch)
treebf6bd88e7bdc3da2a01d51c3b989d0a2be6563d6 /src/freedreno
parent56842d33d53f3ea76b9359e8ead2ea4487e62dc1 (diff)
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 <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]>
Diffstat (limited to 'src/freedreno')
-rw-r--r--src/freedreno/ir3/ir3_context.c10
-rw-r--r--src/freedreno/ir3/ir3_nir.c4
-rw-r--r--src/freedreno/ir3/ir3_nir.h2
-rw-r--r--src/freedreno/ir3/ir3_shader.c4
4 files changed, 8 insertions, 12 deletions
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);