summaryrefslogtreecommitdiffstats
path: root/src/amd
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2019-11-22 22:47:02 -0500
committerMarek Olšák <[email protected]>2019-11-25 16:48:27 -0500
commitb02e0d260489cef7e98b222a52358dd75b0a37b4 (patch)
tree8cac7d38c2f453d7e2255f98f2c58b6d6021d55a /src/amd
parent4675cb2019cdab3f4980e3f98ce243f668092425 (diff)
radeonsi/nir: don't run si_nir_opts again if there is no change
0.3% less overhead Reviewed-by: Pierre-Eric Pelloux-Prayer <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src/amd')
-rw-r--r--src/amd/llvm/ac_nir_to_llvm.c15
-rw-r--r--src/amd/llvm/ac_nir_to_llvm.h2
2 files changed, 10 insertions, 7 deletions
diff --git a/src/amd/llvm/ac_nir_to_llvm.c b/src/amd/llvm/ac_nir_to_llvm.c
index 2eba80a9c38..210a37a3906 100644
--- a/src/amd/llvm/ac_nir_to_llvm.c
+++ b/src/amd/llvm/ac_nir_to_llvm.c
@@ -4783,17 +4783,19 @@ void ac_nir_translate(struct ac_llvm_context *ac, struct ac_shader_abi *abi,
ralloc_free(ctx.vars);
}
-void
+bool
ac_lower_indirect_derefs(struct nir_shader *nir, enum chip_class chip_class)
{
+ bool progress = false;
+
/* Lower large variables to scratch first so that we won't bloat the
* shader by generating large if ladders for them. We later lower
* scratch to alloca's, assuming LLVM won't generate VGPR indexing.
*/
- NIR_PASS_V(nir, nir_lower_vars_to_scratch,
- nir_var_function_temp,
- 256,
- glsl_get_natural_size_align_bytes);
+ NIR_PASS(progress, nir, nir_lower_vars_to_scratch,
+ nir_var_function_temp,
+ 256,
+ glsl_get_natural_size_align_bytes);
/* While it would be nice not to have this flag, we are constrained
* by the reality that LLVM 9.0 has buggy VGPR indexing on GFX9.
@@ -4825,7 +4827,8 @@ ac_lower_indirect_derefs(struct nir_shader *nir, enum chip_class chip_class)
*/
indirect_mask |= nir_var_function_temp;
- nir_lower_indirect_derefs(nir, indirect_mask);
+ progress |= nir_lower_indirect_derefs(nir, indirect_mask);
+ return progress;
}
static unsigned
diff --git a/src/amd/llvm/ac_nir_to_llvm.h b/src/amd/llvm/ac_nir_to_llvm.h
index 7c2d6b31955..b4ad68abb9e 100644
--- a/src/amd/llvm/ac_nir_to_llvm.h
+++ b/src/amd/llvm/ac_nir_to_llvm.h
@@ -46,7 +46,7 @@ static inline unsigned ac_llvm_reg_index_soa(unsigned index, unsigned chan)
return (index * 4) + chan;
}
-void ac_lower_indirect_derefs(struct nir_shader *nir, enum chip_class);
+bool ac_lower_indirect_derefs(struct nir_shader *nir, enum chip_class);
bool ac_are_tessfactors_def_in_all_invocs(const struct nir_shader *nir);