aco/cssa: short-cut some trivial case

If a phi-operand is not flagged as kill, it cannot be coalesced
because it interferes with the live-out variable.
Also do the regClass check earlier.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30182>
This commit is contained in:
Daniel Schürmann 2024-07-23 15:54:01 +02:00 committed by Marge Bot
parent d3e9aef5a2
commit 1d0a12438d

View file

@ -328,7 +328,11 @@ bool
try_coalesce_copy(cssa_ctx& ctx, copy copy, uint32_t block_idx)
{
/* we can only coalesce temporaries */
if (!copy.op.isTemp())
if (!copy.op.isTemp() || !copy.op.isKill())
return false;
/* we can only coalesce copies of the same register class */
if (copy.op.regClass() != copy.def.regClass())
return false;
/* try emplace a merge_node for the copy operand */
@ -343,10 +347,6 @@ try_coalesce_copy(cssa_ctx& ctx, copy copy, uint32_t block_idx)
op_node.value = copy.op;
}
/* we can only coalesce copies of the same register class */
if (copy.op.regClass() != copy.def.regClass())
return false;
/* check if this operand has not yet been coalesced */
if (op_node.index == -1u) {
merge_set op_set = merge_set{copy.op.getTemp()};