panfrost/midgard: Cleanup copy propagation
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Thu, 23 May 2019 02:23:39 +0000 (02:23 +0000)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 4 Jun 2019 20:14:50 +0000 (20:14 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Ryan Houdek <Sonicadvance1@gmail.com>
src/gallium/drivers/panfrost/midgard/midgard_compile.c

index b57b46aaecd92ea431339dc23995e48da6ce7a02..c519193a56a98c52fc0b73b6552df48be55e75c2 100644 (file)
@@ -1769,17 +1769,10 @@ midgard_opt_copy_prop(compiler_context *ctx, midgard_block *block)
                 if (mir_nontrivial_mod(src, is_int, mask)) continue;
                 if (ins->alu.outmod != midgard_outmod_none) continue;
 
-                mir_foreach_instr_in_block_from(block, v, mir_next_op(ins)) {
-                        if (v->ssa_args.src0 == to) {
-                                v->ssa_args.src0 = from;
-                                progress = true;
-                        }
-
-                        if (v->ssa_args.src1 == to && !v->ssa_args.inline_constant) {
-                                v->ssa_args.src1 = from;
-                                progress = true;
-                        }
-                }
+                /* We're clear -- rewrite */
+                mir_rewrite_index_src(ctx, to, from);
+                mir_remove_instruction(ins);
+                progress |= true;
         }
 
         return progress;