i965/vs: Preserve the type when copy propagating into an instruction.
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 25 Oct 2012 09:29:15 +0000 (02:29 -0700)
committerAndreas Boll <andreas.boll.dev@gmail.com>
Sun, 20 Jan 2013 14:08:27 +0000 (15:08 +0100)
commit05974cb8c6cce68344b5622c5cb55adf3e51164c
treec34ce48e05976fe01281f3f275d651d5a0aefe58
parent97eed6da9704deb2c57fe47cd110c2b70191e2c2
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@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 03ea156f1b3e57ef223c0340afb49e513fa0b407)
src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp