On 04/24/2013 04:30 PM, Fabian Bieler wrote:
Do not propagate a copy if source and destination are identical.

Otherwise code like

MOV TEMP[0].xyzw, TEMP[0].wzyx
MOV TEMP[1].xyzw, TEMP[0].xyzw

is changed to

MOV TEMP[0].xyzw, TEMP[0].wzyx
MOV TEMP[1].xyzw, TEMP[0].wzyx

This fixes Piglit test shaders/glsl-copy-propagation-self-2 for drivers that
use Mesa IR.

D'oh.  Good catch.  Please add

NOTE: This is a candidate for stable branches.

to the commit message.

Reviewed-by: Ian Romanick <ian.d.roman...@intel.com>

---
  src/mesa/program/ir_to_mesa.cpp | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index 14cf5ba..dff1762 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -2757,6 +2757,8 @@ ir_to_mesa_visitor::copy_propagate(void)
        /* If this is a copy, add it to the ACP. */
        if (inst->op == OPCODE_MOV &&
          inst->dst.file == PROGRAM_TEMPORARY &&
+         !(inst->dst.file == inst->src[0].file &&
+           inst->dst.index == inst->src[0].index) &&
          !inst->dst.reladdr &&
          !inst->saturate &&
          !inst->src[0].reladdr &&


_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to