prog_optimize: Only merge writes to temporary registers
authorBenjamin Segovia <benjamin.segovia@intel.com>
Tue, 17 Aug 2010 03:40:09 +0000 (20:40 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Tue, 17 Aug 2010 21:57:18 +0000 (14:57 -0700)
In one optimization pass, register files may have been messed therefore
merging instructions which use the same index in two different register
files.

src/mesa/program/prog_optimize.c

index ab878755e25dc28c938e87ffc3e36b72ff8ee954..0dc779073db53ecfa36ac3e1220bd506103916e1 100644 (file)
@@ -758,7 +758,11 @@ _mesa_remove_extra_moves(struct gl_program *prog)
          nesting--;
          break;
       case OPCODE_MOV:
-         if (i > 0 && can_downward_mov_be_modifed(mov) && nesting == 0) {
+         if (i > 0 &&
+             can_downward_mov_be_modifed(mov) &&
+             mov->SrcReg[0].File == PROGRAM_TEMPORARY &&
+             nesting == 0)
+         {
 
             /* see if this MOV can be removed */
             const GLuint id = mov->SrcReg[0].Index;