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: 3185cb7dbf ("ac: Add NIR passes to lower ES->GS I/O to memory accesses.")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9730>
This commit is contained in:
Vinson Lee 2021-03-20 12:17:14 -07:00
parent d248c91162
commit d7f7045108

View file

@ -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);