summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorCaio Marcelo de Oliveira Filho <[email protected]>2019-01-16 11:27:43 -0800
committerCaio Marcelo de Oliveira Filho <[email protected]>2019-02-28 23:50:05 -0800
commite84c841fb07cbb3e2d5d28ab55c91ccd8cf41f64 (patch)
tree890a9f5a6fc2500d947a9ac9abb9e74bfdaf65f3 /src
parent6c614492517e6af0bc333807dcef12f0939131ba (diff)
nir/copy_prop_vars: rename/refactor store_to_entry helper
The name reflected this function role back when the pass also did dead write elimination. So rename it to what it does now, which is setting a value using another value; and narrow the argument list. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/compiler/nir/nir_opt_copy_prop_vars.c42
1 files changed, 20 insertions, 22 deletions
diff --git a/src/compiler/nir/nir_opt_copy_prop_vars.c b/src/compiler/nir/nir_opt_copy_prop_vars.c
index 4a900096b6c..83680b6139d 100644
--- a/src/compiler/nir/nir_opt_copy_prop_vars.c
+++ b/src/compiler/nir/nir_opt_copy_prop_vars.c
@@ -385,25 +385,25 @@ apply_barrier_for_modes(struct util_dynarray *copies,
}
static void
-store_to_entry(struct copy_prop_var_state *state, struct copy_entry *entry,
- const struct value *value, unsigned write_mask)
+value_set_from_value(struct value *value, const struct value *from,
+ unsigned write_mask)
{
- if (value->is_ssa) {
- /* Clear src if it was being used as non-SSA. */
- if (!entry->src.is_ssa)
- memset(&entry->src.ssa, 0, sizeof(entry->src.ssa));
- entry->src.is_ssa = true;
+ if (from->is_ssa) {
+ /* Clear value if it was being used as non-SSA. */
+ if (!value->is_ssa)
+ memset(&value->ssa, 0, sizeof(value->ssa));
+ value->is_ssa = true;
/* Only overwrite the written components */
for (unsigned i = 0; i < 4; i++) {
if (write_mask & (1 << i)) {
- entry->src.ssa.def[i] = value->ssa.def[i];
- entry->src.ssa.component[i] = value->ssa.component[i];
+ value->ssa.def[i] = from->ssa.def[i];
+ value->ssa.component[i] = from->ssa.component[i];
}
}
} else {
/* Non-ssa stores always write everything */
- entry->src.is_ssa = false;
- entry->src.deref = value->deref;
+ value->is_ssa = false;
+ value->deref = from->deref;
}
}
@@ -803,18 +803,16 @@ copy_prop_vars_block(struct copy_prop_var_state *state,
* to do this, we need an exact match, not just something that
* contains what we're looking for.
*/
- struct copy_entry *store_entry =
+ struct copy_entry *entry =
lookup_entry_for_deref(copies, src, nir_derefs_equal_bit);
- if (!store_entry)
- store_entry = copy_entry_create(copies, src);
+ if (!entry)
+ entry = copy_entry_create(copies, src);
- /* Set up a store to this entry with the value of the load. This way
- * we can potentially remove subsequent loads. However, we use a
- * NULL instruction so we don't try and delete the load on a
- * subsequent store.
+ /* Update the entry with the value of the load. This way
+ * we can potentially remove subsequent loads.
*/
- store_to_entry(state, store_entry, &value,
- ((1 << intrin->num_components) - 1));
+ value_set_from_value(&entry->src, &value,
+ (1 << intrin->num_components) - 1);
break;
}
@@ -841,7 +839,7 @@ copy_prop_vars_block(struct copy_prop_var_state *state,
unsigned wrmask = nir_intrinsic_write_mask(intrin);
struct copy_entry *entry =
get_entry_and_kill_aliases(copies, dst, wrmask);
- store_to_entry(state, entry, &value, wrmask);
+ value_set_from_value(&entry->src, &value, wrmask);
}
break;
@@ -897,7 +895,7 @@ copy_prop_vars_block(struct copy_prop_var_state *state,
struct copy_entry *dst_entry =
get_entry_and_kill_aliases(copies, dst, 0xf);
- store_to_entry(state, dst_entry, &value, 0xf);
+ value_set_from_value(&dst_entry->src, &value, 0xf);
break;
}