Mesa (master): i965/vs: Preserve the type when copy propagating into an instruction.

Kenneth Graunke kwg at kemper.freedesktop.org
Thu Oct 25 21:54:56 UTC 2012


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Thu Oct 25 02:29:15 2012 -0700

i965/vs: Preserve the type when copy propagating into an instruction.

Consider the following code, which reinterprets a register as a
different type:

mov(8)          g6<1>F          g1.4<0,4,1>.xF
and(8)          g5<1>.xUD       g6<4,4,1>.xUD   0x7fffffffUD

Copy propagation would notice that we can replace the use of g6 with
g1.4 and eliminate the MOV.  Unfortunately, it failed to preserve the UD
type, incorrectly generating:

and(8)          g5<1>.xUD       g6<4,4,1>.xF    0x7fffffffUD

Found while debugging Ian's uncommitted ARB_vertex_program LOG opcode
test with my new Mesa IR -> Vec4 IR translator.

NOTE: This is a candidate for stable release branches.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Eric Anholt <eric at anholt.net>

---

 .../drivers/dri/i965/brw_vec4_copy_propagation.cpp |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
index 4d27c53..ca757c3 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
@@ -224,6 +224,7 @@ try_copy_propagation(struct intel_context *intel,
    if (value.equals(&inst->src[arg]))
       return false;
 
+   value.type = inst->src[arg].type;
    inst->src[arg] = value;
    return true;
 }




More information about the mesa-commit mailing list