Mesa (master): ac: Fix emit_split_buffer_store modulus operation.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Mar 24 03:09:13 UTC 2021
Module: Mesa
Branch: master
Commit: d7f704510837cc54ae840c299e6178a89a285cca
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d7f704510837cc54ae840c299e6178a89a285cca
Author: Vinson Lee <vlee at freedesktop.org>
Date: Sat Mar 20 12:17:14 2021 -0700
ac: Fix emit_split_buffer_store modulus operation.
Fix defect reported by Coverity Scan.
Operands don't affect result (CONSTANT_EXPRESSION_RESULT)
result_independent_of_operands: start_byte % 2 == 2 is always
false regardless of the values of its operands. This occurs as the
logical operand of if.
Fixes: 3185cb7dbf6 ("ac: Add NIR passes to lower ES->GS I/O to memory accesses.")
Signed-off-by: Vinson Lee <vlee at freedesktop.org>
Reviewed-by: Timur Kristóf <timur.kristof at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9730>
---
src/amd/common/ac_nir_lower_esgs_io_to_mem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/amd/common/ac_nir_lower_esgs_io_to_mem.c b/src/amd/common/ac_nir_lower_esgs_io_to_mem.c
index ee365704ba6..cd7f7cba701 100644
--- a/src/amd/common/ac_nir_lower_esgs_io_to_mem.c
+++ b/src/amd/common/ac_nir_lower_esgs_io_to_mem.c
@@ -95,7 +95,7 @@ emit_split_buffer_store(nir_builder *b, nir_ssa_def *d, nir_ssa_def *desc, nir_s
unsigned store_bytes = MIN2(bytes, 4u);
if ((start_byte % 4) == 1 || (start_byte % 4) == 3)
store_bytes = MIN2(store_bytes, 1);
- else if ((start_byte % 2) == 2)
+ else if ((start_byte % 4) == 2)
store_bytes = MIN2(store_bytes, 2);
nir_ssa_def *store_val = nir_extract_bits(b, &d, 1, start_byte * 8u, 1, store_bytes * 8u);
More information about the mesa-commit
mailing list