Mesa (master): st/mesa: kill instruction if writemask= 0 in eliminate_dead_code_advanced()

Brian Paul brianp at kemper.freedesktop.org
Thu Oct 13 14:35:37 UTC 2011


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

Author: Brian Paul <brianp at vmware.com>
Date:   Thu Oct 13 08:35:19 2011 -0600

st/mesa: kill instruction if writemask=0 in eliminate_dead_code_advanced()

This fixes a bug where we'd wind up emitting an invalid instruction like
MOVE R[0]., R[1];  - note the empty/zero writemask.  If we don't write to
any dest register channels, cull the instruction.

v2: simply change/fix the existing test for instruction culling.

---

 src/mesa/state_tracker/st_glsl_to_tgsi.cpp |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index fe65ae5..9cc5687 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -3772,7 +3772,7 @@ glsl_to_tgsi_visitor::eliminate_dead_code_advanced(void)
       
       if (!inst->dead_mask || !inst->dst.writemask)
          continue;
-      else if (inst->dead_mask == inst->dst.writemask) {
+      else if ((inst->dst.writemask & ~inst->dead_mask) == 0) {
          iter.remove();
          delete inst;
          removed++;




More information about the mesa-commit mailing list