panfrost/midgard: Promote to *move*, not rewrite for non-SSA
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 19 Jul 2019 22:51:51 +0000 (15:51 -0700)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 22 Jul 2019 15:20:34 +0000 (08:20 -0700)
Fixes promoted uniform loads to registers.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/panfrost/midgard/mir_promote_uniforms.c

index 7206cb70165b488106bc47194f18a5918d8ae6c5..227b943a8f9addb6724a9297aa014c221da87364 100644 (file)
@@ -67,9 +67,16 @@ midgard_promote_uniforms(compiler_context *ctx, unsigned register_pressure)
                 /* It is, great! Let's promote */
 
                 ctx->uniform_cutoff = MAX2(ctx->uniform_cutoff, address + 1);
-
                 unsigned promoted = SSA_FIXED_REGISTER(uniform_reg);
-                mir_rewrite_index_src(ctx, ins->ssa_args.dest, promoted);
+
+                /* We do need the move for safety for a non-SSA dest */
+
+                if (ins->ssa_args.dest >= ctx->func->impl->ssa_alloc) {
+                        midgard_instruction mov = v_mov(promoted, blank_alu_src, ins->ssa_args.dest);
+                        mir_insert_instruction_before(ins, mov);
+                } else {
+                        mir_rewrite_index_src(ctx, ins->ssa_args.dest, promoted);
+                }
 
                 mir_remove_instruction(ins);
         }