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.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25670>
This commit is contained in:
Caio Oliveira 2023-10-10 17:47:39 -07:00 committed by Marge Bot
parent 96e0d979a7
commit 6d2503e935

View file

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