i965/fs: Calculate interference better in register_coalesce.
authorMatt Turner <mattst88@gmail.com>
Sun, 15 Dec 2013 23:39:29 +0000 (15:39 -0800)
committerMatt Turner <mattst88@gmail.com>
Tue, 21 Jan 2014 22:09:33 +0000 (14:09 -0800)
commitede6c341f686def647bf8ee4912e759b3d9933a6
treefb2caf75708e54bf0cd70d69f5a77201e938dbee
parent4a7d0c550e28ae3d434da81c9029272d22fa315e
i965/fs: Calculate interference better in register_coalesce.

Previously we simply considered two registers whose live ranges
overlapped to interfere. Cases such as

   set A     ------
   ...             |
   mov B, A  --    |
   ...         | B | A
   use B     --    |
   ...             |
   use A     ------

would be considered to interfere, even though B is an unmodified copy of
A whose live range fit wholly inside that of A.

If no writes to A or B occur between the mov B, A and the use of B then
we can safely coalesce them.

Instead of removing MOV instructions, we make them NOPs and remove them
at once after the main pass is finished in order to avoid recomputing
live intervals (which are needed to perform the previous step).

total instructions in shared programs: 1543768 -> 1513077 (-1.99%)
instructions in affected programs:     951563 -> 920872 (-3.23%)
GAINED:                                46
LOST:                                  22

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
src/mesa/drivers/dri/i965/brw_fs.cpp