intel/fs: Don't try to copy propagate into a source again after progress is made
authorIan Romanick <ian.d.romanick@intel.com>
Fri, 18 Aug 2023 16:34:35 +0000 (09:34 -0700)
committerMarge Bot <emma+marge@anholt.net>
Thu, 14 Sep 2023 22:31:22 +0000 (22:31 +0000)
commit8665e37960f2ad495500a1cf1d8f007beb22b119
tree0db2ff18d9709fbd43784f15c96ecc3d1547855e
parente488b46419b17524aeac454f2312cc5493187a05
intel/fs: Don't try to copy propagate into a source again after progress is made

If the linked list structure used depended on the list head to know when
to terminate, this would be a pretty serious bug. If try_constant_propage
or try_copy_propagate make progress, inst->src[i].nr will change. This
results in the foreach_in_list using a different list header on later
iterations of the loop.

This causes two shaders in shader-db and 9 shaders in fossil-db to
change. Looking at the code changes, these are cases where there was a
copy of a copy that gets propagated. The part that confuses me is the
VGRF numbers involved should **not** hash to the same bucket, so it
should be impossible to find the original source from the intermediate
VGRF.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25091>
src/intel/compiler/brw_fs_copy_propagation.cpp