Module: Mesa Branch: main Commit: 6d2503e93517f0b39e0799be17bd27ce25222824 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6d2503e93517f0b39e0799be17bd27ce25222824
Author: Caio Oliveira <caio.olive...@intel.com> Date: Tue Oct 10 17:47:39 2023 -0700 intel/fs: Only allocate acp_entry if we are adding one In practice it seems we are always entering here, haven't looked in detail whether at this point we could just assert. But for now only allocate a new acp_entry if we are going to add it. Reviewed-by: Ian Romanick <ian.d.roman...@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25670> --- src/intel/compiler/brw_fs_copy_propagation.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/intel/compiler/brw_fs_copy_propagation.cpp b/src/intel/compiler/brw_fs_copy_propagation.cpp index 4dacd3bc1d3..3a5b917cdb3 100644 --- a/src/intel/compiler/brw_fs_copy_propagation.cpp +++ b/src/intel/compiler/brw_fs_copy_propagation.cpp @@ -1377,17 +1377,16 @@ opt_copy_propagation_local(const brw_compiler *compiler, void *copy_prop_ctx, inst->src[i].is_contiguous())) { const brw_reg_type t = i < inst->header_size ? BRW_REGISTER_TYPE_UD : inst->src[i].type; - acp_entry *entry = rzalloc(copy_prop_ctx, acp_entry); - entry->dst = byte_offset(retype(inst->dst, t), offset); - entry->src = retype(inst->src[i], t); - entry->size_written = size_written; - entry->size_read = inst->size_read(i); - entry->opcode = inst->opcode; - entry->force_writemask_all = inst->force_writemask_all; - if (!entry->dst.equals(inst->src[i])) { + fs_reg dst = byte_offset(retype(inst->dst, t), offset); + if (!dst.equals(inst->src[i])) { + acp_entry *entry = rzalloc(copy_prop_ctx, acp_entry); + entry->dst = dst; + entry->src = retype(inst->src[i], t); + entry->size_written = size_written; + entry->size_read = inst->size_read(i); + entry->opcode = inst->opcode; + entry->force_writemask_all = inst->force_writemask_all; acp.add(entry); - } else { - ralloc_free(entry); } } offset += size_written;