summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIlia Mirkin <imirkin@alum.mit.edu>2014-09-30 23:27:25 -0400
committerEmil Velikov <emil.l.velikov@gmail.com>2014-10-29 17:44:20 +0000
commit502c2950259ae26b95725eeb0e7520b3ff78db70 (patch)
tree030737c8472a1b96bc52add5b20b37fb38efeb93 /src
parentc4f58245d0add5c1633cd8bbf038bbe1fd86cf78 (diff)
freedreno/ir3: avoid fan-in sources referring to same instruction
Since the RA has to be done s.t. each one gets its own (adjacent) register, it would complicate matters if instructions were allowed to be repeated. This enables copy-propagation use in situations where previously that might have happened. Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Signed-off-by: Rob Clark <robclark@freedesktop.org> (cherry picked from commit 3dd9a0d6fdea1ff5b1fe903fce206bf1d1515400)
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3_cp.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_cp.c b/src/gallium/drivers/freedreno/ir3/ir3_cp.c
index 73c2a27c6eb..83bcb7a742b 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_cp.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_cp.c
@@ -70,7 +70,7 @@ static void walk_children(struct ir3_instruction *instr, bool keep)
static struct ir3_instruction *
instr_cp_fanin(struct ir3_instruction *instr)
{
- unsigned i;
+ unsigned i, j;
/* we need to handle fanin specially, to detect cases
* when we need to keep a mov
@@ -92,7 +92,15 @@ instr_cp_fanin(struct ir3_instruction *instr)
if (is_meta(cand) && (cand->opc == OPC_META_FO))
cand = instr_cp(src->instr, true);
- src->instr = cand;
+ /* we can't have 2 registers referring to the same instruction, so
+ * go through and check if any already refer to the candidate
+ * instruction. if so, don't do the propagation.
+ */
+ for (j = 1; j < instr->regs_count; j++)
+ if (instr->regs[j]->instr == cand)
+ break;
+ if (j == instr->regs_count)
+ src->instr = cand;
}
}