From 157e3046bd9f82af70dad4599f51b43818578a23 Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Tue, 8 Mar 2022 13:57:04 +0100 Subject: [PATCH] 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: 9912c61362b ("ir3/spill: Support larger spill slot offset") Part-of: (cherry picked from commit 5f020bcc8d00f91136d91f453c572684a48c149d) --- .pick_status.json | 2 +- src/freedreno/ir3/ir3_lower_spill.c | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 9a851ebf038..04d992a35da 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -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" }, diff --git a/src/freedreno/ir3/ir3_lower_spill.c b/src/freedreno/ir3/ir3_lower_spill.c index 30d255e6f0c..f5782786af4 100644 --- a/src/freedreno/ir3/ir3_lower_spill.c +++ b/src/freedreno/ir3/ir3_lower_spill.c @@ -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;