diff options
author | Timothy Arceri <[email protected]> | 2019-02-20 14:03:37 +1100 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2019-02-22 08:36:36 +1100 |
commit | d9e08e753bf4125edcdb561bbe80547999eb8e32 (patch) | |
tree | c39a7648ca0439f8d7d59f1af06cb81bbc983951 /src | |
parent | cd0ac3a6af64478a1f1552225733ba2405a31dc6 (diff) |
nir: clone instruction set rather than removing individual entries
This reduces the time spent in nir_opt_cse() by almost a half.
The massif tool from callgrind reported no change in peak
memory use with the large doliphin uber shaders I used for
testing.
Reviewed-by: Thomas Helland<[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/nir/nir_opt_cse.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/compiler/nir/nir_opt_cse.c b/src/compiler/nir/nir_opt_cse.c index bf42a6a33dc..3c3617d852a 100644 --- a/src/compiler/nir/nir_opt_cse.c +++ b/src/compiler/nir/nir_opt_cse.c @@ -39,9 +39,10 @@ */ static bool -cse_block(nir_block *block, struct set *instr_set) +cse_block(nir_block *block, struct set *dominance_set) { bool progress = false; + struct set *instr_set = _mesa_set_clone(dominance_set, NULL); nir_foreach_instr_safe(instr, block) { if (nir_instr_set_add_or_rewrite(instr_set, instr)) { @@ -55,8 +56,7 @@ cse_block(nir_block *block, struct set *instr_set) progress |= cse_block(child, instr_set); } - nir_foreach_instr(instr, block) - nir_instr_set_remove(instr_set, instr); + _mesa_set_destroy(instr_set, NULL); return progress; } |