diff options
author | Rob Clark <robdclark@chromium.org> | 2020-04-06 08:28:35 -0700 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2020-04-13 20:47:28 +0000 |
commit | 0f22f85fe73f89b80851bb24936202c9bba97cc6 (patch) | |
tree | e6c7756007f68fbe2cd3f6708f2dbcca70026bb2 /src/freedreno | |
parent | 908044ef4bf00daccfbcb037144c6ebe74d021c5 (diff) |
freedreno/ir3: fix location of inserted mov's
If the group pass must insert a mov to resolve conflicts, avoid the mov
appearing *after* the meta:collect whose src it is.
The current pre-RA scheduler doesn't really care about the initial
instruction order, but the new one will in some cases.
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4440>
Diffstat (limited to 'src/freedreno')
-rw-r--r-- | src/freedreno/ir3/ir3_group.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/freedreno/ir3/ir3_group.c b/src/freedreno/ir3/ir3_group.c index 07d0681ceef..4fc236708d7 100644 --- a/src/freedreno/ir3/ir3_group.c +++ b/src/freedreno/ir3/ir3_group.c @@ -34,7 +34,17 @@ static void insert_mov(struct ir3_instruction *collect, int idx) { struct ir3_instruction *src = ssa(collect->regs[idx+1]); - collect->regs[idx+1]->instr = ir3_MOV(src->block, src, TYPE_F32); + struct ir3_instruction *mov = ir3_MOV(src->block, src, TYPE_F32); + collect->regs[idx+1]->instr = mov; + + /* if collect and src are in the same block, move the inserted mov + * to just before the collect to avoid a use-before-def. Otherwise + * it should be safe to leave at the end of the block it is in: + */ + if (src->block == collect->block) { + list_delinit(&mov->node); + list_addtail(&mov->node, &collect->node); + } } /* verify that cur != instr, but cur is also not in instr's neighbor-list: */ |