mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 06:58:05 +02:00
pan/bi: Fix source swizzle in bi_repair_ssa
Repairing SSA was creating invalid PHI nodes with source swizzles != BI_SWIZZLE_H01. PHI sources can't have non-identity swizzles. In most cases the repair logic only replaces sources, in which case the swizzle is taken from the old source that is getting replaced. However, in add_phi_operands there is no old source because the phi is new, and so the result from resolve_read is assigned directly. This falsely carries over the destination swizzle to the source. Since it never makes sense for resolve_read to carry over the swizzle from the instruction writing the value, we can make it so that resolve_read always returns the identity swizzle on indices. resolve_read returns one of: - An index stored by record_write - An index created by bi_temp_like - The result of a recursive resolve_read call bi_temp_like already correctly sets the swizzle to H01. Setting it in record_write leads to both base cases returning the desired swizzle. Fixes:dd94d183("pan/bi: Fixup bi_repair_ssa.c for bi") Reviewed-by: Lorenzo Rossi <lorenzo.rossi@collabora.com> Reviewed-by: Eric R. Smith <eric.smith@collabora.com> (cherry picked from commitfcfc580f67) Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41268>
This commit is contained in:
parent
905e8efa73
commit
10aea75a3f
2 changed files with 10 additions and 1 deletions
|
|
@ -2344,7 +2344,7 @@
|
|||
"description": "pan/bi: Fix source swizzle in bi_repair_ssa",
|
||||
"nominated": true,
|
||||
"nomination_type": 2,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "dd94d1833f6cd05a123ca4aa038a6547685ec20b",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -50,6 +50,14 @@ record_write(struct repair_ctx *ctx, bi_block *block, unsigned node,
|
|||
bi_index val)
|
||||
{
|
||||
assert(node < ctx->n);
|
||||
|
||||
/* The value always gets used as a source, where we don't want the
|
||||
* destination "swizzle" and other modifiers that are applied on write.
|
||||
*/
|
||||
val.swizzle = BI_SWIZZLE_H01;
|
||||
val.neg = false;
|
||||
val.abs = false;
|
||||
|
||||
struct hash_table_u64 *defs = repair_block(ctx, block)->defs;
|
||||
_mesa_hash_table_u64_insert(defs, node,
|
||||
ralloc_memdup(defs, &val, sizeof(val)));
|
||||
|
|
@ -106,6 +114,7 @@ resolve_read(struct repair_ctx *ctx, bi_block *block, bi_index node)
|
|||
}
|
||||
|
||||
assert(!bi_is_null(val));
|
||||
assert(val.swizzle == BI_SWIZZLE_H01);
|
||||
record_write(ctx, block, node.value, val);
|
||||
return val;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue