nir/large_constants: only search for constant duplicates

Fixes: b6d4753568 ("nir/large_constants: De-duplicate constants")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3706
Signed-off-by: Yevhenii Kolesnikov <yevhenii.kolesnikov@globallogic.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7350>
(cherry picked from commit ea81889ea4)
This commit is contained in:
Yevhenii Kolesnikov 2020-10-28 16:56:19 +02:00 committed by Dylan Baker
parent e21a96791c
commit 194d070040
2 changed files with 4 additions and 2 deletions

View file

@ -5593,7 +5593,7 @@
"description": "nir/large_constants: only search for constant duplicates",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"master_sha": null,
"because_sha": "b6d475356846f57a034e662ab9245d11ed0dd4a0"
},

View file

@ -50,7 +50,9 @@ var_info_cmp(const void *_a, const void *_b)
uint32_t a_size = a->constant_data_size;
uint32_t b_size = b->constant_data_size;
if (a_size < b_size) {
if (a->is_constant != b->is_constant) {
return (int)a->is_constant - (int)b->is_constant;
} else if (a_size < b_size) {
return -1;
} else if (a_size > b_size) {
return 1;