aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/nir
diff options
context:
space:
mode:
authorConnor Abbott <[email protected]>2019-03-27 12:11:36 +0100
committerConnor Abbott <[email protected]>2019-05-31 19:13:59 +0200
commit3bd073301182b4bb2dae28bee6175ebe78184f3d (patch)
tree6b59b3382a553615306982fd89c100232d720160 /src/compiler/nir
parent8a838e172f3f796b2d5d01cb51e05b37ae6f48f5 (diff)
nir/instr_set: Use _mesa_set_search_or_add()
Before this change, we were searching for each instruction twice, once when checking if it exists and once when figuring out where to insert it. By using the new function, we can do everything we need to do in one operation. Compilation time numbers for my shader-db database: Difference at 95.0% confidence -4.04706 +/- 0.669508 -0.922142% +/- 0.151948% (Student's t, pooled s = 0.95824) Reviewed-by: Eric Anholt <[email protected]> Acked-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/compiler/nir')
-rw-r--r--src/compiler/nir/nir_instr_set.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/compiler/nir/nir_instr_set.c b/src/compiler/nir/nir_instr_set.c
index 80c03127810..1a6a7ab7743 100644
--- a/src/compiler/nir/nir_instr_set.c
+++ b/src/compiler/nir/nir_instr_set.c
@@ -824,11 +824,10 @@ nir_instr_set_add_or_rewrite(struct set *instr_set, nir_instr *instr)
if (!instr_can_rewrite(instr))
return false;
- uint32_t hash = hash_instr(instr);
- struct set_entry *e = _mesa_set_search_pre_hashed(instr_set, hash, instr);
- if (e) {
+ struct set_entry *e = _mesa_set_search_or_add(instr_set, instr);
+ nir_instr *match = (nir_instr *) e->key;
+ if (match != instr) {
nir_ssa_def *def = nir_instr_get_dest_ssa_def(instr);
- nir_instr *match = (nir_instr *) e->key;
nir_ssa_def *new_def = nir_instr_get_dest_ssa_def(match);
/* It's safe to replace an exact instruction with an inexact one as
@@ -843,7 +842,6 @@ nir_instr_set_add_or_rewrite(struct set *instr_set, nir_instr *instr)
return true;
}
- _mesa_set_add_pre_hashed(instr_set, hash, instr);
return false;
}