OSDN Git Service

nir: properly find the entry to keep in copy_prop_vars
authorCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Sat, 15 Dec 2018 00:10:32 +0000 (16:10 -0800)
committerEmil Velikov <emil.l.velikov@gmail.com>
Fri, 11 Jan 2019 19:19:08 +0000 (19:19 +0000)
commitbcfca5b35cfec467ef36487116a56dce85c589db
tree78523d046534ad9a976ebc363417d5ab950f7b0f
parent3af043858503c1ce066989f9531e95332bbf1bc0
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: b3c61469255 "nir: Copy propagation between blocks"
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
(cherry picked from commit 947f7b452a550c66cfb9a8c9518e35635eb25947)
src/compiler/nir/nir_opt_copy_prop_vars.c