mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-05 04:40:11 +01:00
nir: properly find the entry to keep in copy_prop_vars
When copy propagation handles a store/copy, it iterates the current copy entries to remove aliases, but keeps the "equal" entry (if exists) to be updated. The removal step may swap the entries around (to ensure there are no holes), invalidating previous iteration pointers. The bug was saving such pointer to use later. Change the code to first perform the removals and then find the remaining right entry. This was causing updates to be lost since they were being made to an entry that was not part of the current copies. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108624 Fixes:b3c6146925"nir: Copy propagation between blocks" Cc: mesa-stable@lists.freedesktop.org Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> (cherry picked from commit947f7b452a)
This commit is contained in:
parent
3af0438585
commit
bcfca5b35c
1 changed files with 16 additions and 3 deletions
|
|
@ -265,7 +265,7 @@ lookup_entry_and_kill_aliases(struct util_dynarray *copies,
|
|||
{
|
||||
/* TODO: Take into account the write_mask. */
|
||||
|
||||
struct copy_entry *entry = NULL;
|
||||
nir_deref_instr *dst_match = NULL;
|
||||
util_dynarray_foreach_reverse(copies, struct copy_entry, iter) {
|
||||
if (!iter->src.is_ssa) {
|
||||
/* If this write aliases the source of some entry, get rid of it */
|
||||
|
|
@ -278,13 +278,26 @@ lookup_entry_and_kill_aliases(struct util_dynarray *copies,
|
|||
nir_deref_compare_result comp = nir_compare_derefs(iter->dst, deref);
|
||||
|
||||
if (comp & nir_derefs_equal_bit) {
|
||||
assert(entry == NULL);
|
||||
entry = iter;
|
||||
/* Removing entries invalidate previous iter pointers, so we'll
|
||||
* collect the matching entry later. Just make sure it is unique.
|
||||
*/
|
||||
assert(!dst_match);
|
||||
dst_match = iter->dst;
|
||||
} else if (comp & nir_derefs_may_alias_bit) {
|
||||
copy_entry_remove(copies, iter);
|
||||
}
|
||||
}
|
||||
|
||||
struct copy_entry *entry = NULL;
|
||||
if (dst_match) {
|
||||
util_dynarray_foreach(copies, struct copy_entry, iter) {
|
||||
if (iter->dst == dst_match) {
|
||||
entry = iter;
|
||||
break;
|
||||
}
|
||||
}
|
||||
assert(entry);
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue