ir3/lower_spill: Fix corner case with oob offsets

If the base register is killed, it may be reused as the destination of a
ldp. In that case we should just skip resetting it afterwards.

Fixes regressions in dEQP-VK.ssbo.layout.random.scalar.38 later.

Fixes: 9912c61362 ("ir3/spill: Support larger spill slot offset")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15288>
(cherry picked from commit 5f020bcc8d)
This commit is contained in:
Connor Abbott 2022-03-08 13:57:04 +01:00 committed by Dylan Baker
parent 08fd564c16
commit 157e3046bd
2 changed files with 10 additions and 2 deletions

View file

@ -328,7 +328,7 @@
"description": "ir3/lower_spill: Fix corner case with oob offsets",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "9912c61362b650e09dad7ec6fc6a72095969ffab"
},

View file

@ -65,8 +65,16 @@ set_base_reg(struct ir3_instruction *mem, unsigned val)
static void
reset_base_reg(struct ir3_instruction *mem)
{
/* If the base register is killed, then we don't need to clobber it and it
* may be reused as a destination so we can't always clobber it after the
* instruction anyway.
*/
struct ir3_register *base = mem->srcs[0];
if (base->flags & IR3_REG_KILL)
return;
struct ir3_instruction *mov = ir3_instr_create(mem->block, OPC_MOV, 1, 1);
ir3_dst_create(mov, mem->srcs[0]->num, mem->srcs[0]->flags);
ir3_dst_create(mov, base->num, base->flags);
ir3_src_create(mov, INVALID_REG, IR3_REG_IMMED)->uim_val = 0;
mov->cat1.dst_type = mov->cat1.src_type = TYPE_U32;