Mesa (master): vc4: DCE instructions with a NULL destination.

Eric Anholt anholt at kemper.freedesktop.org
Mon Jul 4 23:38:50 UTC 2016


Module: Mesa
Branch: master
Commit: aa76ba6f2fb0d6438b2b652d9fa466b6cf77fa31
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=aa76ba6f2fb0d6438b2b652d9fa466b6cf77fa31

Author: Eric Anholt <eric at anholt.net>
Date:   Fri Jun  3 15:06:52 2016 -0700

vc4: DCE instructions with a NULL destination.

I'm going to add an optimization for redundant SF update removal, which
will just remove the SF and leave us (in many cases) with an instruction
with a NULL destination and no side effects.  Rather than teaching that
pass whether the whole instruction can be removed, leave that
responsibility to this pass.

---

 src/gallium/drivers/vc4/vc4_opt_dead_code.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/vc4/vc4_opt_dead_code.c b/src/gallium/drivers/vc4/vc4_opt_dead_code.c
index d3562ee..ad51ed7 100644
--- a/src/gallium/drivers/vc4/vc4_opt_dead_code.c
+++ b/src/gallium/drivers/vc4/vc4_opt_dead_code.c
@@ -86,8 +86,9 @@ qir_opt_dead_code(struct vc4_compile *c)
 
         list_for_each_entry_safe_rev(struct qinst, inst, &c->instructions,
                                      link) {
-                if (inst->dst.file == QFILE_TEMP &&
-                    !used[inst->dst.index] &&
+                if ((inst->dst.file == QFILE_NULL ||
+                     (inst->dst.file == QFILE_TEMP &&
+                      !used[inst->dst.index])) &&
                     !inst->sf &&
                     !qir_has_side_effects(c, inst) &&
                     !has_nonremovable_reads(c, inst)) {




More information about the mesa-commit mailing list