pan/bi: Respect side effects in DCE
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 3 Feb 2021 19:35:02 +0000 (14:35 -0500)
committerMarge Bot <eric+marge@anholt.net>
Fri, 5 Feb 2021 17:49:44 +0000 (17:49 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8848>

src/panfrost/bifrost/bi_opt_dce.c

index 517ff11..589198e 100644 (file)
@@ -48,7 +48,7 @@ bi_opt_dead_code_eliminate(bi_context *ctx, bi_block *block, bool soft)
                 unsigned index = bi_get_node(ins->dest[0]);
 
                 if (index < temp_count && !live[index]) {
-                        if (soft)
+                        if (soft || bi_side_effects(ins->op))
                                 ins->dest[0] = bi_null();
                         else
                                 bi_remove_instruction(ins);