panfrost/midgard: Skip liveness analysis for instructions without dest
authorTomeu Vizoso <tomeu.vizoso@collabora.com>
Mon, 22 Apr 2019 15:06:24 +0000 (17:06 +0200)
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>
Thu, 2 May 2019 15:29:48 +0000 (15:29 +0000)
[Alyssa: Add comment explanation]

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
src/gallium/drivers/panfrost/midgard/midgard_compile.c

index d4d26b9a25e9b2d5b7ae5c14d5d18050d0e2fdd2..e1d2edf1670602daff4b7273eb475c699c411d95 100644 (file)
@@ -2109,6 +2109,13 @@ allocate_registers(compiler_context *ctx)
                 mir_foreach_instr_in_block(block, ins) {
                         if (ins->compact_branch) continue;
 
+                        /* Dest is < 0 for store_vary instructions, which break
+                         * the usual SSA conventions. Liveness analysis doesn't
+                         * make sense on these instructions, so skip them to
+                         * avoid memory corruption */
+
+                        if (ins->ssa_args.dest < 0) continue;
+
                         if (ins->ssa_args.dest < SSA_FIXED_MINIMUM) {
                                 /* If this destination is not yet live, it is now since we just wrote it */