Mesa (master): ir3: Don't assume regs[1] exists in ir3_fixup_src_type()

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon May 3 20:15:37 UTC 2021


Module: Mesa
Branch: master
Commit: 9fa587ae96ae7682e1d8fb31e9e6b3cde8b621c4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9fa587ae96ae7682e1d8fb31e9e6b3cde8b621c4

Author: Connor Abbott <cwabbott0 at gmail.com>
Date:   Sat Feb 20 20:22:50 2021 +0100

ir3: Don't assume regs[1] exists in ir3_fixup_src_type()

It won't exist for phi nodes because they are only partially constructed
beforehand. Move it into the switch arguments where we know it's needed.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10591>

---

 src/freedreno/ir3/ir3.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/freedreno/ir3/ir3.c b/src/freedreno/ir3/ir3.c
index ecc1cf4d912..5a5b416b469 100644
--- a/src/freedreno/ir3/ir3.c
+++ b/src/freedreno/ir3/ir3.c
@@ -623,18 +623,16 @@ ir3_set_dst_type(struct ir3_instruction *instr, bool half)
 void
 ir3_fixup_src_type(struct ir3_instruction *instr)
 {
-	bool half = !!(instr->regs[1]->flags & IR3_REG_HALF);
-
 	switch (opc_cat(instr->opc)) {
 	case 1: /* move instructions */
-		if (half) {
+		if (instr->regs[1]->flags & IR3_REG_HALF) {
 			instr->cat1.src_type = half_type(instr->cat1.src_type);
 		} else {
 			instr->cat1.src_type = full_type(instr->cat1.src_type);
 		}
 		break;
 	case 3:
-		if (half) {
+		if (instr->regs[1]->flags & IR3_REG_HALF) {
 			instr->opc = cat3_half_opc(instr->opc);
 		} else {
 			instr->opc = cat3_full_opc(instr->opc);



More information about the mesa-commit mailing list