From 194d070040131a26dc524ae306c8fc9b2a9fa11a Mon Sep 17 00:00:00 2001 From: Yevhenii Kolesnikov Date: Wed, 28 Oct 2020 16:56:19 +0200 Subject: [PATCH] nir/large_constants: only search for constant duplicates Fixes: b6d47535684 ("nir/large_constants: De-duplicate constants") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3706 Signed-off-by: Yevhenii Kolesnikov Reviewed-by: Rhys Perry Reviewed-by: Jason Ekstrand Part-of: (cherry picked from commit ea81889ea436c2de7e3f3937f95f96e71d4c50ad) --- .pick_status.json | 2 +- src/compiler/nir/nir_opt_large_constants.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index ed83e28d011..9205e3927a9 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -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" }, diff --git a/src/compiler/nir/nir_opt_large_constants.c b/src/compiler/nir/nir_opt_large_constants.c index 94af7a464b1..01356758e3d 100644 --- a/src/compiler/nir/nir_opt_large_constants.c +++ b/src/compiler/nir/nir_opt_large_constants.c @@ -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;